body.auth-required .app-shell {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(76, 145, 230, 0.2), transparent 28%),
    radial-gradient(circle at bottom left, rgba(213, 164, 60, 0.15), transparent 28%),
    rgba(8, 18, 34, 0.7);
}

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

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid rgba(211, 221, 235, 0.9);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 251, 255, 0.92)),
    #fff;
  box-shadow: 0 28px 80px rgba(8, 18, 34, 0.35);
}

.login-card img {
  width: 176px;
  height: auto;
  margin-bottom: 22px;
}

.login-card h1 {
  margin: 0 0 20px;
  font-size: 26px;
  letter-spacing: 0;
}

.login-card .primary-button {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
}

.todo-page {
  display: grid;
  grid-template-columns: minmax(250px, 280px) minmax(480px, 0.95fr) minmax(360px, 1.05fr);
  gap: 12px;
  align-items: start;
  position: relative;
}

.tasks-section-heading {
  justify-content: flex-end;
  min-height: 0;
}

.tasks-section-heading h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.todo-sidebar,
.todo-main,
.todo-detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.todo-sidebar {
  padding: 12px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
}

.todo-rail-header,
.todo-toolbar,
.todo-item-title,
.todo-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.todo-rail-header {
  justify-content: space-between;
  margin-bottom: 12px;
}

.todo-filter-list {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.todo-filter-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.todo-filter-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-filter-button small,
.todo-list-button small {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf3f8;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.todo-filter-button.active,
.todo-filter-button:hover {
  border-color: #b9d6fb;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.todo-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: start;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.todo-list-row.active,
.todo-list-row:hover {
  border-color: #b9d6fb;
  background: var(--accent-soft);
}

.todo-list-button {
  width: 100%;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  column-gap: 10px;
  row-gap: 3px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.todo-list-button > span {
  grid-row: 1 / span 2;
  margin-top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.todo-list-button.color-green > span { background: #12836f; }
.todo-list-button.color-gold > span { background: #b8871f; }
.todo-list-button.color-red > span { background: #be4b43; }
.todo-list-button.color-purple > span { background: #805ad5; }

.todo-list-button strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
  white-space: normal;
}

.todo-list-button small {
  grid-column: 2;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.todo-list-row.active .todo-list-button,
.todo-list-row:hover .todo-list-button {
  color: var(--accent-dark);
}

.todo-list-edit {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  margin-top: 7px;
}

.todo-list-edit:hover {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.todo-sync-note {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  background: #f5f8fb;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.todo-main {
  min-height: 560px;
  max-height: calc(100vh - 132px);
  display: flex;
  flex-direction: column;
}

.todo-commandbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(250px, 0.85fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f7fafc);
}

.todo-quick-add {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.todo-quick-add .icon-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border-color: rgba(7, 79, 166, 0.78);
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(39, 110, 241, 0.18);
}

.todo-quick-add .icon-button:hover,
.todo-quick-add .icon-button:focus-visible {
  border-color: var(--accent-dark);
  background: linear-gradient(180deg, var(--accent-dark), #094591);
  color: #fff;
}

.todo-quick-add input {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 700;
}

.todo-toolbar {
  padding: 0;
  border: 0;
  background: transparent;
}

.todo-toolbar input,
.todo-toolbar select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}

.todo-toolbar input {
  flex: 1;
  min-width: 0;
}

.todo-stats {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.todo-stats article {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 9px 14px 9px 0;
  margin-right: 14px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.todo-stats article:last-child {
  margin-right: 0;
  border-right: 0;
}

.todo-stats strong,
.todo-stats span {
  display: inline;
}

.todo-stats strong {
  font-size: 16px;
}

.todo-stats span {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.todo-list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.72);
}

.todo-list-summary {
  display: grid;
  gap: 4px;
}

.todo-list-summary strong {
  font-size: 15px;
}

.todo-list-summary span,
.todo-sort-label span {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.todo-sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-sort-select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.todo-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 12px;
  background: #f8fafc;
}

.todo-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
  margin-top: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.todo-item:hover {
  background: #f8fbff;
}

.todo-item.selected {
  background: #ecf5ff;
  border-color: #b9d6fb;
  box-shadow: inset 4px 0 0 var(--accent), 0 8px 18px rgba(15, 35, 64, 0.05);
}

.todo-item.child {
  margin-left: 36px;
  border-left: 1px solid var(--line);
}

.todo-item.dragging {
  opacity: 0.56;
}

.todo-item.drop-target {
  background: #f3f8ff;
  box-shadow: inset 0 0 0 2px rgba(59, 106, 204, 0.24);
}

.todo-item.today {
  background: #f6fbff;
}

.todo-item.overdue {
  background: #fff7f5;
}

.todo-item.done {
  opacity: 0.68;
}

.todo-check {
  width: 24px;
  height: 24px;
  border: 2px solid #9fb1c4;
  border-radius: 50%;
  background: #fff;
  color: #12836f;
  font-weight: 900;
  line-height: 1;
}

.todo-star {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #8a98a8;
  font-size: 19px;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.todo-item:hover .todo-star,
.todo-item.selected .todo-star,
.todo-item:focus-within .todo-star,
.todo-star.active {
  opacity: 1;
}

.todo-star:hover,
.todo-star.active {
  border-color: #f0d89a;
  background: #fff7df;
  color: #b8871f;
}

.todo-item-title {
  display: grid;
  gap: 3px;
  align-items: start;
}

.todo-item-title strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.todo-item-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.todo-meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.todo-item-title span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-item-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.todo-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 15px;
}

.todo-item p.todo-source-line {
  color: #52637a;
  font-size: 13px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.todo-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.todo-chip.source {
  background: rgba(39, 110, 241, 0.08);
  color: #2d5fae;
}

.todo-chip.source-missing {
  background: #fff5e7;
  color: #965d12;
}

.todo-chip.today {
  background: rgba(191, 114, 29, 0.11);
  color: #9a5715;
}

.todo-chip.overdue {
  background: rgba(190, 49, 49, 0.1);
  color: #ab2f2f;
}

.todo-drag-handle {
  flex: 0 0 auto;
  color: #92a0b5;
  font-size: 18px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.todo-empty {
  margin: 18px;
  padding: 28px;
  border: 1px dashed #c8d6e3;
  border-radius: 12px;
  background: #fbfdff;
}

.todo-empty strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.todo-empty p {
  margin: 0 0 18px;
  color: var(--muted);
}

.todo-detail {
  position: sticky;
  z-index: 2;
  top: 12px;
  width: auto;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: none;
  box-shadow: var(--shadow);
  transition: none;
}

.todo-page.detail-open .todo-detail {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: none;
}

.todo-detail-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px 34px;
  gap: 12px;
  align-items: start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f7fafc);
}

.todo-detail-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.todo-detail-header strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.todo-detail-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

@media (min-width: 1501px) {
  .todo-detail-close {
    display: none;
  }
}

.todo-detail-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.todo-detail-fields {
  margin: 0;
}

.todo-detail-fields div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.todo-detail-fields div:nth-child(odd) {
  background: rgba(248, 251, 255, 0.56);
}

.todo-detail-fields dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.todo-detail-fields dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.45;
}

.todo-detail-notes {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.todo-detail-notes strong {
  display: block;
  margin-bottom: 8px;
}

.todo-detail-next {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.todo-detail-next strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.todo-detail-next p {
  margin: 0;
  color: #304054;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.45;
}

.todo-detail-assistant {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.todo-detail-assistant strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.todo-detail-assistant div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.todo-detail-origin {
  display: grid;
  gap: 8px;
  margin: 0 18px;
  padding: 14px 16px;
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  background: #f7fbff;
}

.todo-detail-origin.stale {
  border-color: #efd4a2;
  background: #fffaf0;
}

.todo-detail-origin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.todo-detail-origin strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.todo-detail-origin-heading span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e9f4ee;
  color: #2e7456;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.todo-detail-origin.stale .todo-detail-origin-heading span {
  background: #fff0d2;
  color: #935d12;
}

.todo-detail-origin p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
  font-weight: 700;
}

.todo-detail-origin p b {
  color: var(--ink);
  font-weight: 900;
}

.todo-detail-origin small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.todo-detail-notes p,
.todo-detail-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.todo-detail-link {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--accent-dark);
  font-weight: 900;
}

.todo-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
}

.todo-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px 0;
}

.todo-detail-links.primary-links {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.todo-detail-empty {
  padding: 22px;
}

.todo-detail-empty strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

body[data-theme="dark"] .todo-sidebar,
body[data-theme="dark"] .todo-main,
body[data-theme="dark"] .todo-detail {
  background: linear-gradient(180deg, #111d31, #0d1728);
  border-color: rgba(123, 151, 190, 0.28);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .todo-commandbar,
body[data-theme="dark"] .todo-detail-header {
  background: linear-gradient(180deg, #16243a, #101b2d);
}

body[data-theme="dark"] .todo-toolbar {
  background: transparent;
}

@media (hover: none) {
  .todo-item .todo-star {
    opacity: 1;
  }
}

body[data-theme="dark"] .todo-detail-next {
  background: rgba(31, 49, 77, 0.78);
  border-color: rgba(123, 151, 190, 0.28);
}

body[data-theme="dark"] .todo-detail-next strong,
body[data-theme="dark"] .todo-detail-next p {
  color: #d7e3f6;
}

body[data-theme="dark"] .todo-detail-assistant {
  border-color: rgba(123, 151, 190, 0.28);
}

body[data-theme="dark"] .todo-detail-assistant strong {
  color: #d7e3f6;
}

body[data-theme="dark"] .todo-detail-origin {
  border-color: rgba(123, 151, 190, 0.28);
  background: rgba(31, 49, 77, 0.78);
}

body[data-theme="dark"] .todo-detail-origin.stale {
  border-color: rgba(224, 168, 84, 0.42);
  background: rgba(70, 48, 26, 0.52);
}

body[data-theme="dark"] .todo-detail-origin strong {
  color: #d7e3f6;
}

body[data-theme="dark"] .todo-detail-origin-heading span {
  background: rgba(93, 170, 127, 0.18);
  color: #b9e2cb;
}

body[data-theme="dark"] .todo-detail-origin.stale .todo-detail-origin-heading span {
  background: rgba(224, 168, 84, 0.18);
  color: #f0c684;
}

body[data-theme="dark"] .todo-detail-origin p {
  color: #a9b8cc;
}

body[data-theme="dark"] .todo-detail-origin p b {
  color: #e8eef8;
}

body[data-theme="dark"] .todo-detail-origin small {
  color: #8fa2bf;
}

body[data-theme="dark"] .todo-quick-add input,
body[data-theme="dark"] .todo-toolbar input,
body[data-theme="dark"] .todo-toolbar select {
  background: #0a1322;
  border-color: rgba(148, 169, 202, 0.34);
  color: #e8eef8;
}

body[data-theme="dark"] .todo-quick-add input::placeholder,
body[data-theme="dark"] .todo-toolbar input::placeholder {
  color: #70809a;
}

body[data-theme="dark"] .todo-filter-button small,
body[data-theme="dark"] .todo-item-title span,
body[data-theme="dark"] .todo-meta span {
  background: rgba(135, 164, 207, 0.16);
  color: #b9c7dc;
}

body[data-theme="dark"] .todo-meta span.todo-chip.source {
  background: rgba(78, 136, 232, 0.2);
  color: #c7d9fb;
}

body[data-theme="dark"] .todo-meta span.todo-chip.source-missing {
  background: rgba(224, 168, 84, 0.2);
  color: #f0c684;
}

body[data-theme="dark"] .todo-item p.todo-source-line {
  color: #c5d1e0;
}

body[data-theme="dark"] .todo-list-button small {
  background: transparent;
  color: #b9c7dc;
}

body[data-theme="dark"] .todo-list-controls {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 169, 202, 0.22);
}

body[data-theme="dark"] .todo-sort-select {
  background: #0a1322;
  border-color: rgba(148, 169, 202, 0.34);
  color: #e8eef8;
}

body[data-theme="dark"] .todo-filter-button.active,
body[data-theme="dark"] .todo-filter-button:hover,
body[data-theme="dark"] .todo-list-row.active,
body[data-theme="dark"] .todo-list-row:hover {
  border-color: rgba(98, 160, 255, 0.46);
  background: rgba(98, 160, 255, 0.14);
  color: #d8e7ff;
}

body[data-theme="dark"] .todo-list-edit:hover,
body[data-theme="dark"] .todo-stats article,
body[data-theme="dark"] .todo-empty,
body[data-theme="dark"] .todo-sync-note {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(148, 169, 202, 0.28);
}

body[data-theme="dark"] .todo-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

body[data-theme="dark"] .todo-item.selected {
  background: rgba(98, 160, 255, 0.16);
}

body[data-theme="dark"] .todo-item.today {
  background: rgba(98, 160, 255, 0.08);
}

body[data-theme="dark"] .todo-item.overdue {
  background: rgba(190, 75, 67, 0.14);
}

body[data-theme="dark"] .todo-item.drop-target {
  background: rgba(59, 106, 204, 0.16);
  box-shadow: inset 0 0 0 2px rgba(121, 164, 255, 0.34);
}

body[data-theme="dark"] .todo-check {
  background: #0a1322;
  border-color: #6f86a7;
}

body[data-theme="dark"] .todo-star:hover,
body[data-theme="dark"] .todo-star.active {
  border-color: rgba(240, 216, 154, 0.46);
  background: rgba(227, 182, 75, 0.16);
}

body[data-theme="dark"] .todo-chip {
  background: rgba(135, 164, 207, 0.14);
  color: #c7d5ea;
}

body[data-theme="dark"] .todo-chip.source {
  background: rgba(80, 132, 234, 0.22);
  color: #dbe6ff;
}

body[data-theme="dark"] .todo-chip.today {
  background: rgba(206, 140, 63, 0.2);
  color: #ffd6a3;
}

body[data-theme="dark"] .todo-chip.overdue {
  background: rgba(190, 75, 67, 0.22);
  color: #ffb8ae;
}

body[data-theme="dark"] .todo-drag-handle {
  color: #a4b5cc;
}

body[data-theme="dark"] .todo-detail-fields div:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.todo-page .command-card,
.todo-page + .review-panel {
  max-width: 100%;
}

.login-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: #b42318;
  font-weight: 800;
}

.login-error:empty {
  display: none;
}

.login-help-link {
  justify-self: start;
  margin-top: 0;
  padding: 0;
  min-height: auto;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: #25559c;
  font-weight: 800;
  text-align: left;
}

.login-remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.login-remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--auth-button-start, var(--accent));
}

.login-captcha {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fbfefd 0, #f4faf8 100%);
}

.login-captcha-head {
  display: grid;
  gap: 4px;
}

.login-captcha-head strong {
  font-size: 15px;
}

.login-captcha-head span {
  color: var(--muted);
  font-size: 13px;
}

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

.login-captcha-track {
  position: relative;
  height: 60px;
  border-radius: 18px;
  border: 1px solid #dbe5ef;
  background:
    radial-gradient(circle at 18% 30%, rgba(15, 118, 110, 0.08), transparent 18%),
    radial-gradient(circle at 76% 58%, rgba(37, 99, 235, 0.08), transparent 18%),
    linear-gradient(180deg, #ffffff 0, #f3f7fb 100%);
  overflow: hidden;
}

.login-captcha-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(47, 111, 214, 0.18), rgba(123, 88, 184, 0.08));
}

.login-captcha-slot,
.login-captcha-piece {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-captcha-slot {
  border: 2px dashed rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.08);
}

.login-captcha-piece {
  left: -18px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  transition: background 120ms ease, transform 120ms ease;
}

.login-captcha-slider {
  width: 100%;
  accent-color: var(--auth-button-start, #2f6fd6);
}

.login-captcha.is-verified {
  border-color: #94d8c7;
  background: linear-gradient(180deg, #f8fffc 0, #eefbf6 100%);
}

.login-captcha.is-verified .login-captcha-piece {
  background: linear-gradient(90deg, var(--auth-button-start, #2f6fd6), var(--auth-button-end, #7b58b8));
  transform: scale(1.03);
}

.login-reset-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.login-reset-panel[hidden],
.login-reset-panel [hidden] {
  display: none;
}

button,
input {
  font: inherit;
}

textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid rgba(47, 111, 214, 0.5);
  outline-offset: 2px;
}

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

.mobile-menu-button,
.mobile-nav-backdrop {
  display: none;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  align-self: start;
  width: 264px;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at top, rgba(78, 164, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 280px),
    var(--nav);
  color: #f8fbfa;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.brand {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding-right: 40px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 4px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(77, 150, 255, 0.22), rgba(28, 184, 163, 0.18));
  color: #eef7ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-mark {
  grid-column: 1;
  grid-row: 1;
  width: 172px;
  height: 44px;
  display: flex;
  align-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(22, 47, 82, 0.9), rgba(12, 20, 33, 0.5));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  position: relative;
}

.brand-mark::after {
  content: none;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

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

.brand > div:not(.brand-mark) {
  grid-column: 1;
  grid-row: 2;
}

.brand strong {
  font-size: 17px;
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.brand span {
  margin-top: 3px;
  color: rgba(248, 251, 250, 0.72);
  font-size: 11px;
}

.topbar .eyebrow {
  display: none;
}

.sidebar-toggle {
  position: absolute;
  top: 0;
  right: 0;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

body.native-shell .sidebar-toggle {
  display: none;
}

.account-card {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fbfa;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  text-align: left;
  min-width: 0;
  overflow: hidden;
}

.account-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(94, 168, 255, 0.44);
}

.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(94, 168, 255, 0.18), rgba(28, 184, 163, 0.16));
  color: #bfe6ff;
  border: 1px solid rgba(94, 168, 255, 0.32);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.account-avatar em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-style: normal;
  line-height: 1;
  text-align: center;
}

.account-avatar.large {
  width: 74px;
  height: 74px;
  font-size: 24px;
}

.account-avatar.has-image {
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.account-avatar.avatar-loaded em {
  display: none;
}

.account-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.account-avatar.avatar-loaded img {
  opacity: 1;
}

.avatar-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--brand);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.avatar-upload-button.inline {
  margin: 0 0 12px;
}

.avatar-upload-button input {
  display: none;
}

.workspace-user-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-modal-summary {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  padding: 14px;
}

.account-modal-summary h3 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.08;
}

.account-modal-summary p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.account-modal-upload {
  justify-self: end;
}

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

.account-facts div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 12px;
  display: grid;
  gap: 5px;
}

.account-facts span,
.account-authorized-apps > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-facts strong {
  color: var(--ink);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.account-authorized-apps {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.account-app-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.account-app-card.active {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.account-app-card strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.account-app-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}

.account-app-card.active em {
  color: #2f7d3f;
}

.account-app-open {
  width: 34px;
  height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #fff;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.account-app-open:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e40af;
}

.account-card strong,
.account-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card > span:not(.account-avatar) {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.account-card strong {
  font-size: 13px;
  line-height: 1.2;
}

.account-card small {
  margin-top: 3px;
  color: rgba(248, 251, 250, 0.62);
  font-size: 11px;
}

.mobile-menu-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(26, 32, 38, 0.08);
}

.mobile-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

body.sidebar-collapsed .sidebar {
  align-items: center;
  width: 76px;
  padding: 18px 12px;
}

body.sidebar-collapsed .brand {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  justify-items: center;
  gap: 10px;
  padding-right: 0;
}

body.sidebar-collapsed .brand-mark {
  width: 44px;
  height: 36px;
}

body.sidebar-collapsed .brand-mark img {
  width: 100%;
  height: 100%;
  max-width: none;
  transform: none;
}

body.sidebar-collapsed .brand-badge,
body.sidebar-collapsed .brand > div:not(.brand-mark) {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  position: static;
  margin-top: 2px;
}

body.sidebar-collapsed .account-card {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
}

body.sidebar-collapsed .account-card span:last-child {
  display: none;
}

body.sidebar-collapsed .nav-item {
  width: 44px;
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-item span:last-child,
body.sidebar-collapsed .mode-badge {
  display: none;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.topnav-brand {
  display: none;
}

.nav-item {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 251, 250, 0.76);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(90deg, rgba(94, 168, 255, 0.22), rgba(28, 184, 163, 0.08));
  color: #fff;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  color: var(--cloud);
  text-align: center;
}

.nav-item svg.icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
}

.icon-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 850;
}

.mode-badge {
  width: 100%;
  min-height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(94, 168, 255, 0.34);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(94, 168, 255, 0.16), rgba(28, 184, 163, 0.12));
  color: #cde3ff;
  font-size: 13px;
  font-weight: 800;
}

.workspace {
  grid-column: 2;
  padding: 20px;
  padding-bottom: max(80px, calc(20px + env(safe-area-inset-bottom)));
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(240px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(214, 223, 235, 0.72);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.86));
  box-shadow: 0 10px 30px rgba(12, 26, 45, 0.08);
}

.topbar-mail-search {
  --mail-topbar-control-height: 42px;
  --mail-topbar-icon-size: 42px;
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(132px, auto) auto 42px 42px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-mail-search input,
.topbar-mail-search select {
  width: 100%;
  min-height: var(--mail-topbar-control-height);
  border: 1px solid rgba(190, 204, 221, 0.9);
  border-radius: 12px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.topbar-mail-search select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--muted);
  padding-right: 30px;
}

.mail-view-options {
  position: relative;
  flex: 0 0 auto;
}

.mail-view-options summary {
  list-style: none;
  display: grid;
  place-items: center;
  width: var(--mail-topbar-icon-size, 42px);
  min-height: var(--mail-topbar-control-height, 42px);
  border: 1px solid rgba(190, 204, 221, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #47556a;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}

.mail-view-options summary::-webkit-details-marker {
  display: none;
}

.mail-view-options[open] summary,
.mail-view-options summary:hover {
  border-color: rgba(54, 107, 214, 0.55);
  color: #1f56b3;
  box-shadow: 0 10px 24px rgba(42, 85, 150, 0.12);
}

.mail-view-options-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: min(310px, calc(100vw - 28px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(193, 207, 227, 0.9);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 32, 58, 0.18);
}

.mail-view-options-menu label {
  display: grid;
  gap: 6px;
  color: #65758c;
  font-size: 12px;
  font-weight: 800;
}

.mail-view-options-menu label > span {
  text-transform: uppercase;
  letter-spacing: 0;
}

.mail-view-options-menu select {
  min-height: 38px;
  border-radius: 9px;
  font-weight: 750;
}

.mail-view-options-menu .mail-view-check {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
}

.mail-view-options-menu .mail-view-check input {
  width: 16px;
  height: 16px;
}

.mail-view-options-menu .mail-view-check span {
  text-transform: none;
  letter-spacing: 0;
}

.mail-refresh-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(#fff, #f8fafb);
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(20, 32, 51, 0.06);
}

.mail-refresh-button:hover {
  border-color: rgba(39, 110, 241, 0.34);
  color: var(--accent);
  transform: translateY(-1px);
}

.topbar-compose-button {
  min-height: 36px;
  white-space: nowrap;
}

body[data-theme="dark"] .topbar-mail-search input,
body[data-theme="dark"] .topbar-mail-search select,
body[data-theme="dark"] .mail-view-options summary,
body[data-theme="dark"] .mail-refresh-button {
  background: #132033;
  border-color: rgba(148, 163, 184, 0.3);
  color: #bfdbfe;
}

body[data-theme="dark"] .topbar-mail-search input {
  color: #f8fafc;
}

body[data-theme="dark"] .mail-view-options-menu {
  background: #132033;
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

body[data-theme="dark"] .mail-view-options-menu label {
  color: #aebbd0;
}

body[data-theme="dark"] .mail-view-options-menu .mail-view-check {
  color: #e5eefc;
}

body[data-theme="dark"] .mail-refresh-button {
  box-shadow: none;
}

.topbar-mail-search input:focus {
  outline: none;
  border-color: rgba(39, 110, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(39, 110, 241, 0.12);
}

body[data-view="mail"] .topbar-mail-search {
  display: grid;
}
