:root {
  --panel-width: min(880px, 100%);
  --dropdown-control-width: min(248px, 76vw);
  --template-control-width: var(--dropdown-control-width);
  --dropdown-control-height: 1.64rem;
  --dropdown-control-font-size: 0.77rem;
  --dropdown-control-padding-x: 0.56rem;
  --dropdown-menu-padding: 0.32rem;
  --dropdown-menu-gap: 0.22rem;
  --dropdown-menu-max-height: min(252px, 58vh);
  --dropdown-options-max-height: min(152px, 34vh);
  --dropdown-option-font-size: 0.76rem;
  --due-date-control-width: 11.4rem;
  --bg-base: #fff2e8;
  --bg-layer: #ffe9d8;
  --panel-bg: rgba(255, 248, 240, 0.9);
  --panel-border: rgba(198, 109, 61, 0.24);
  --text-main: #3b2115;
  --text-muted: #855946;
  --accent: #e56b3d;
  --accent-soft: #ffd8c2;
  --danger-soft: #fff0e6;
  --shadow-lg: 0 24px 44px rgba(106, 49, 20, 0.16);
  --shadow-md: 0 12px 26px rgba(106, 49, 20, 0.11);
  --shadow-sm: 0 4px 10px rgba(106, 49, 20, 0.08);
  --radius-xl: 14px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 2.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: "Space Mono", "Courier New", monospace;
  font-size: 15px;
  color: var(--text-main);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: clamp(0.75rem, 2.2vw, 1.35rem);
  position: relative;
  overflow: visible;
  background: linear-gradient(160deg, #fff0e3 0%, #ffe7d5 48%, #ffdfca 100%);
}

.brand-panel {
  width: var(--panel-width);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--panel-bg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.48rem 0.92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  overflow: visible;
  z-index: 3;
}

.brand-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  min-width: 0;
}

.brand-mark {
  width: 1.85rem;
  height: 1.85rem;
  flex: 0 0 auto;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-copy-main {
  gap: 0.68rem;
}

.brand-mark-main {
  width: 2rem;
  height: 2rem;
  transform: translateY(-0.5px);
  filter: drop-shadow(0 3px 8px rgba(183, 92, 47, 0.22));
}

.brand-title-main {
  font-size: clamp(1.95rem, 3.9vw, 2.48rem);
  line-height: 1.02;
  letter-spacing: 0.018em;
}

.brand-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.12;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.18;
  color: var(--text-muted);
}

.session-controls {
  margin-left: auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.session-greeting {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.2;
  max-width: min(42vw, 300px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-menu {
  position: relative;
  flex: 0 0 auto;
}

.session-menu-toggle {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #8f553d;
  width: auto;
  height: auto;
  padding: 0.02rem 0.06rem;
  font-size: 1.24rem;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

.session-menu-toggle:hover {
  transform: translateY(-1px) scale(1.04);
  color: #b85d36;
}

.session-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.32rem);
  right: 0;
  width: min(8.6rem, 52vw);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 8px;
  background: #fff8f0;
  box-shadow: var(--shadow-md);
  padding: var(--dropdown-menu-padding);
  display: flex;
  flex-direction: column;
  gap: var(--dropdown-menu-gap);
  z-index: 20;
}

.session-menu-dropdown[hidden] {
  display: none;
}

.session-menu-option {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(190, 110, 66, 0.26);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  text-align: left;
  font-size: var(--dropdown-option-font-size);
  line-height: 1.25;
  min-height: 1.46rem;
  padding: 0.31rem 0.4rem;
  cursor: pointer;
}

.session-menu-option:hover {
  background: var(--accent-soft);
}

.task-panel {
  width: var(--panel-width);
  min-height: min(84vh, 720px);
  min-height: min(84dvh, 720px);
  max-height: calc(100vh - 6.25rem);
  max-height: calc(100dvh - 6.25rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space-2);
  padding: clamp(0.9rem, 1.5vw, 1.2rem);
  border-radius: var(--radius-xl);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  z-index: 1;
}

@supports not ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .brand-panel,
  .task-panel {
    background: #fff7ef;
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 1.9rem;
}

.panel-view-controls {
  display: flex;
  align-items: center;
}

.panel-view-button {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  height: var(--dropdown-control-height);
  padding: 0 0.58rem;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.panel-view-button:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.65);
}

.panel-view-button.is-active {
  color: var(--text-main);
  border-color: rgba(190, 110, 66, 0.42);
  background: #fffaf5;
}

.task-filter-controls {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  margin-left: auto;
  position: relative;
}

.task-filter-picker {
  position: relative;
  width: var(--dropdown-control-width);
  min-width: var(--dropdown-control-width);
  flex: 0 0 var(--dropdown-control-width);
}

.task-filter-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  height: var(--dropdown-control-height);
  padding: 0 var(--dropdown-control-padding-x);
  font-size: var(--dropdown-control-font-size);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.task-filter-toggle:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.65);
}

.task-filter-icon {
  width: 1.02rem;
  height: 1.02rem;
  color: #a15a3d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.task-filter-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.task-filter-toggle-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-filter-toggle-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.task-filter-menu {
  position: absolute;
  top: calc(100% + 0.32rem);
  right: 0;
  width: var(--dropdown-control-width);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 8px;
  background: #fff8f0;
  box-shadow: var(--shadow-md);
  padding: var(--dropdown-menu-padding);
  display: flex;
  flex-direction: column;
  gap: var(--dropdown-menu-gap);
  max-height: var(--dropdown-menu-max-height);
  overflow: hidden;
  z-index: 20;
}

.task-filter-menu[hidden] {
  display: none;
}

.task-filter-options {
  max-height: 0;
}

.task-list {
  overflow-y: auto;
  min-height: 0;
  padding-top: 2px;
  padding-right: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.task-list::-webkit-scrollbar {
  width: 6px;
}

.task-list::-webkit-scrollbar-thumb {
  background: rgba(198, 118, 72, 0.45);
  border-radius: 4px;
}

.empty-state {
  margin: auto;
  width: min(420px, 100%);
  border: none;
  background: transparent;
  text-align: center;
  padding: 0;
  box-shadow: none;
}

.empty-state h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
}

.empty-state p {
  margin: var(--space-1) 0 0;
  color: var(--text-main);
}

.task-item {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(196, 116, 70, 0.28);
  background: #fffcf8;
  box-shadow: var(--shadow-sm);
  padding: 0.44rem 0.56rem;
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.22s ease,
    background-color 0.22s ease;
}

.task-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    112deg,
    rgba(255, 214, 187, 0) 14%,
    rgba(255, 214, 187, 0.56) 48%,
    rgba(255, 214, 187, 0) 82%
  );
  transform: translateX(-130%);
  transition: transform 0.42s ease, opacity 0.18s ease;
}

.task-item:hover,
.task-item:focus-within {
  transform: translateY(-2px);
  border-color: rgba(206, 109, 57, 0.52);
  background: #fff9f2;
  box-shadow: 0 10px 20px rgba(106, 49, 20, 0.16);
}

.task-item.is-overdue {
  border-color: rgba(186, 84, 65, 0.52);
  background: #ffe3da;
}

.task-item.is-overdue:hover,
.task-item.is-overdue:focus-within {
  border-color: rgba(186, 84, 65, 0.68);
  background: #ffd8cc;
}

.task-item.is-completing {
  pointer-events: none;
}

.task-item.is-overdue.is-completing,
.task-item.is-overdue.is-completing:hover,
.task-item.is-overdue.is-completing:focus-within {
  border-color: rgba(186, 84, 65, 0.68);
  background: #ffd8cc;
  box-shadow: 0 10px 20px rgba(106, 49, 20, 0.16);
}

.task-item.is-completing::before {
  opacity: 1;
  animation: task-complete-sweep 0.44s ease forwards;
}

.task-item.is-overdue.is-completing::before {
  background: linear-gradient(
    112deg,
    rgba(255, 245, 240, 0) 12%,
    rgba(255, 245, 240, 0.92) 50%,
    rgba(255, 245, 240, 0) 88%
  );
  animation: task-complete-sweep-overdue 0.44s ease forwards;
}

@keyframes task-complete-sweep {
  0% {
    transform: translateX(-130%);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    transform: translateX(130%);
    opacity: 0.18;
  }
}

@keyframes task-complete-sweep-overdue {
  0% {
    transform: translateX(-130%);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    transform: translateX(130%);
    opacity: 0.32;
  }
}

.task-item-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  position: relative;
  z-index: 1;
}

.task-item-body {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.task-item-body.has-meta {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.34rem;
}

.task-item-body.has-meta .task-item-content {
  grid-column: 1;
}

.task-item-meta {
  grid-column: 2;
  display: grid;
  gap: 0.16rem;
  justify-items: flex-end;
  align-content: start;
}

.task-toggle {
  width: 1.2rem;
  height: 1.2rem;
  appearance: none;
  -webkit-appearance: none;
  border: 1.6px solid rgba(192, 113, 68, 0.62);
  border-radius: 999px;
  background: #fffaf5;
  color: #ffffff;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.task-toggle:hover {
  transform: translateY(-1px);
  background: #ffe7d8;
  border-color: rgba(206, 109, 57, 0.8);
}

.task-toggle.is-complete {
  background: linear-gradient(140deg, #ff7b46, #e55b33);
  border-color: #e55b33;
  color: #fff;
}

.task-delete {
  width: 1.2rem;
  height: 1.2rem;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #b66b44;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.task-delete:hover {
  transform: translateY(-1px);
  background: #ffe8da;
  color: #933f1e;
}

.task-item-content {
  margin: 0;
  color: var(--text-main);
  line-height: 1.3;
  font-size: 0.86rem;
  text-align: left;
  word-break: break-word;
}

.task-item-content[data-template]::before {
  content: attr(data-template) " ";
  font-weight: 700;
  color: #9a4527;
}

.task-item-content p {
  margin: 0;
}

.task-item-content p + p {
  margin-top: 0.14rem;
}

.task-item-date-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 17ch;
  min-height: 1.34rem;
  border: 1px solid rgba(190, 110, 66, 0.34);
  border-radius: 999px;
  padding: 0.12rem 0.56rem;
  font-size: 0.68rem;
  line-height: 1.25;
  white-space: nowrap;
}

.task-item-due-date {
  background: #fff3e8;
  color: #8f4f33;
}

.task-item-completed-date {
  border: 1px solid rgba(84, 134, 104, 0.34);
  background: #eef8f1;
  color: #3f6e52;
}

.task-item.is-complete .task-item-content {
  color: #8b664f;
  text-align: left;
}

.task-item.is-complete .task-item-body.has-meta {
  align-items: center;
}

.task-item.is-complete .task-item-due-date {
  opacity: 1;
}

.task-item.is-complete .task-item-completed-date {
  opacity: 0.92;
}

.task-item.is-complete.is-no-due-date .task-item-completed-date {
  border-color: rgba(190, 110, 66, 0.34);
  background: #fff3e8;
  color: #8f4f33;
}

.task-item.is-complete.is-on-time .task-item-completed-date {
  border-color: rgba(84, 134, 104, 0.34);
  background: #eef8f1;
  color: #3f6e52;
  opacity: 0.92;
}

.task-item.is-complete.is-late .task-item-completed-date {
  border-color: rgba(186, 84, 65, 0.34);
  background: #fff1ec;
  color: #9b4a3a;
  opacity: 0.92;
}

.task-item.is-complete .task-item-content,
.task-item.is-complete .task-item-content * {
  text-decoration: line-through;
  text-decoration-color: rgba(161, 97, 62, 0.62);
  text-decoration-thickness: 1.4px;
}

.composer {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(196, 115, 69, 0.34);
  background: #fff4ea;
  box-shadow: var(--shadow-md);
  padding: 0.58rem 0.62rem;
  display: grid;
  gap: 0.45rem;
}

.composer.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.format-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.34rem;
}

.template-picker {
  position: relative;
  order: -1;
  width: var(--template-control-width);
  min-width: var(--template-control-width);
  flex: 0 0 var(--template-control-width);
}

.template-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--dropdown-control-height);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  padding: 0 var(--dropdown-control-padding-x);
  font-size: var(--dropdown-control-font-size);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.template-toggle:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.65);
}

.template-toggle-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.template-menu {
  position: absolute;
  top: auto;
  bottom: calc(100% + 0.32rem);
  left: 0;
  right: auto;
  width: var(--template-control-width);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 8px;
  background: #fff8f0;
  box-shadow: var(--shadow-md);
  padding: var(--dropdown-menu-padding);
  display: flex;
  flex-direction: column;
  gap: var(--dropdown-menu-gap);
  max-height: var(--dropdown-menu-max-height);
  overflow: hidden;
  z-index: 20;
}

.template-menu[hidden] {
  display: none;
}

.template-menu.is-open-up {
  top: auto;
  bottom: calc(100% + 0.32rem);
}

.template-menu.is-open-down {
  top: calc(100% + 0.32rem);
  bottom: auto;
}

.template-menu.is-side-right {
  top: 0;
  bottom: auto;
  left: calc(100% + 0.34rem);
  right: auto;
}

.template-menu.is-side-left {
  top: 0;
  bottom: auto;
  right: calc(100% + 0.34rem);
  left: auto;
}

.template-options {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 0 1 auto;
  min-height: 0;
  max-height: var(--dropdown-options-max-height);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.12rem;
}

.template-options::-webkit-scrollbar {
  width: 6px;
}

.template-options::-webkit-scrollbar-thumb {
  background: rgba(198, 118, 72, 0.45);
  border-radius: 4px;
}

.template-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  border: 1px solid rgba(190, 110, 66, 0.26);
  border-radius: 6px;
  background: #fffaf5;
}

.template-option {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  font-size: var(--dropdown-option-font-size);
  line-height: 1.25;
  cursor: pointer;
}

.template-option-clear {
  border: 1px solid rgba(190, 110, 66, 0.26);
  border-radius: 6px;
  background: #fffaf5;
  padding: 0.31rem 0.4rem;
}

.template-option-main {
  flex: 1;
  min-width: 0;
  padding: 0.28rem 0.4rem;
}

.template-option-main:hover,
.template-option-clear:hover {
  background: var(--accent-soft);
}

.template-option-main.is-selected,
.template-option-clear.is-selected {
  color: #9a4527;
  font-weight: 700;
}

.template-delete {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #b66b44;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
}

.template-delete:hover {
  background: #ffe8da;
  color: #933f1e;
}

.template-add-trigger {
  appearance: none;
  -webkit-appearance: none;
  border: 1px dashed rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  font-size: 0.78rem;
  text-align: left;
  padding: 0.36rem 0.44rem;
  cursor: pointer;
}

.template-add-trigger:hover {
  background: var(--accent-soft);
}

.template-add-form {
  margin: 0;
}

.template-add-input {
  width: 100%;
  height: 1.76rem;
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffdfa;
  color: var(--text-main);
  padding: 0 0.48rem;
  font-size: 0.78rem;
}

.due-date-picker {
  position: relative;
  order: -1;
  margin-left: auto;
  width: var(--due-date-control-width);
  min-width: var(--due-date-control-width);
  flex: 0 0 var(--due-date-control-width);
}

.due-date-field {
  display: flex;
  align-items: center;
  gap: 0.22rem;
  height: var(--dropdown-control-height);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  padding: 0 0.34rem 0 0.44rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.due-date-field:focus-within {
  background: #fffdf9;
  border-color: rgba(206, 109, 57, 0.65);
}

.due-date-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: var(--dropdown-control-font-size);
  line-height: 1;
}

.due-date-input::placeholder {
  color: #a07056;
}

.due-date-input:focus {
  outline: none;
}

.due-date-input[aria-invalid="true"] {
  color: #aa3f1f;
}

.due-date-toggle {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #9a5b3f;
  width: 1.34rem;
  height: 1.34rem;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.due-date-toggle svg {
  width: 0.94rem;
  height: 0.94rem;
  fill: currentColor;
}

.due-date-toggle:hover {
  background: var(--accent-soft);
  color: #8f4a2f;
}

.due-date-menu {
  position: absolute;
  top: auto;
  bottom: calc(100% + 0.32rem);
  right: 0;
  left: auto;
  width: max(var(--due-date-control-width), 16rem);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 8px;
  background: #fff8f0;
  box-shadow: var(--shadow-md);
  padding: var(--dropdown-menu-padding);
  display: grid;
  gap: var(--dropdown-menu-gap);
  max-height: var(--dropdown-menu-max-height);
  overflow: hidden;
  z-index: 20;
}

.due-date-menu[hidden] {
  display: none;
}

.due-date-header {
  display: grid;
  grid-template-columns: 1.56rem 1fr 1fr 1.56rem;
  align-items: center;
  gap: 0.2rem;
}

.due-date-select-wrap {
  position: relative;
  min-width: 0;
}

.due-date-select-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--dropdown-control-height);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  padding: 0 var(--dropdown-control-padding-x);
  font-size: var(--dropdown-control-font-size);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.due-date-select-toggle:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.65);
}

.due-date-select-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.due-date-select-menu {
  position: absolute;
  top: calc(100% + 0.18rem);
  left: 0;
  right: 0;
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 8px;
  background: #fff8f0;
  box-shadow: var(--shadow-md);
  padding: var(--dropdown-menu-padding);
  display: flex;
  flex-direction: column;
  gap: var(--dropdown-menu-gap);
  max-height: min(142px, 25vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 30;
}

.due-date-select-menu[hidden] {
  display: none;
}

.due-date-select-menu-years {
  max-height: min(176px, 32vh);
}

.due-date-select-menu::-webkit-scrollbar {
  width: 6px;
}

.due-date-select-menu::-webkit-scrollbar-thumb {
  background: rgba(198, 118, 72, 0.45);
  border-radius: 4px;
}

.due-date-select-option {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(190, 110, 66, 0.26);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  text-align: left;
  font-size: var(--dropdown-option-font-size);
  line-height: 1.25;
  padding: 0.31rem 0.4rem;
  cursor: pointer;
}

.due-date-select-option:hover {
  background: var(--accent-soft);
}

.due-date-select-option.is-selected {
  color: #9a4527;
  font-weight: 700;
}

.due-date-nav {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--dropdown-control-height);
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.due-date-nav:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.65);
}

.due-date-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.14rem;
}

.due-date-weekdays span {
  text-align: center;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-muted);
}

.due-date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.14rem;
}

.due-date-day {
  appearance: none;
  -webkit-appearance: none;
  min-height: 1.4rem;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-main);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}

.due-date-day:hover {
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.35);
}

.due-date-day.is-outside {
  color: #b38a74;
}

.due-date-day.is-today {
  border-color: rgba(194, 108, 66, 0.56);
}

.due-date-day.is-selected {
  border-color: rgba(194, 108, 66, 0.7);
  background: #ffe6d4;
  color: #8a452a;
  font-weight: 700;
}

.due-date-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
}

.due-date-footer-button {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(190, 110, 66, 0.26);
  border-radius: 6px;
  background: #fffaf5;
  color: var(--text-main);
  min-height: 1.46rem;
  padding: 0 0.42rem;
  font-size: 0.72rem;
  text-align: center;
  width: 100%;
  cursor: pointer;
}

.due-date-footer-button:hover {
  background: var(--accent-soft);
}

.editor:focus-visible,
.task-toggle:focus-visible,
.task-delete:focus-visible,
.panel-view-button:focus-visible,
.session-menu-toggle:focus-visible,
.session-menu-option:focus-visible,
.template-toggle:focus-visible,
.task-filter-toggle:focus-visible,
.template-option:focus-visible,
.template-delete:focus-visible,
.template-add-trigger:focus-visible,
.template-add-input:focus-visible,
.auth-field input:focus-visible,
.auth-country-search:focus-visible,
.auth-submit:focus-visible,
.due-date-input:focus-visible,
.due-date-toggle:focus-visible,
.due-date-nav:focus-visible,
.due-date-select-toggle:focus-visible,
.due-date-select-option:focus-visible,
.due-date-day:focus-visible,
.due-date-footer-button:focus-visible {
  outline: 2px solid rgba(227, 108, 58, 0.58);
  outline-offset: 2px;
}

.editor {
  min-width: 0;
  min-height: 74px;
  max-height: 132px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  border: 1px solid rgba(194, 115, 70, 0.4);
  border-radius: var(--radius-md);
  background: #fffdfa;
  padding: 0.53rem 0.62rem;
  line-height: 1.4;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: #a07056;
  font-size: 0.79rem;
  position: absolute;
  top: 0.53rem;
  left: 0.62rem;
  right: 0.62rem;
  pointer-events: none;
}

.auth-shell {
  gap: clamp(1rem, 2.2vw, 1.7rem);
}

.auth-shell .brand-panel {
  width: min(540px, 100%);
}

.auth-shell-register .brand-panel {
  width: min(620px, 100%);
}

.auth-shell .brand-title {
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
}

.auth-shell .brand-mark {
  width: 2rem;
  height: 2rem;
}

.auth-panel {
  width: min(540px, 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: clamp(1rem, 2vw, 1.35rem);
  display: grid;
  gap: 1rem;
}

.auth-panel-header {
  display: grid;
  gap: 0.18rem;
}

.auth-title {
  margin: 0;
  font-size: clamp(1.3rem, 2.3vw, 1.62rem);
  letter-spacing: 0.01em;
}

.auth-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.auth-form {
  display: grid;
  gap: 0.7rem;
}

.auth-panel-register {
  width: min(620px, 100%);
}

.auth-form-register {
  gap: 0.64rem;
}

.auth-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.64rem;
}

.auth-country-picker {
  order: 0;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

.auth-country-picker .template-toggle {
  height: 2rem;
  border-radius: 8px;
  font-size: 0.84rem;
  padding: 0 0.62rem;
}

.auth-country-menu {
  top: calc(100% + 0.32rem);
  bottom: auto;
  left: 0;
  right: auto;
  width: 100%;
}

.auth-country-search-wrap {
  display: grid;
  margin-bottom: 0.18rem;
}

.auth-country-search {
  width: 100%;
  height: 1.88rem;
  border: 1px solid rgba(190, 110, 66, 0.42);
  border-radius: 6px;
  background: #fffdfa;
  color: var(--text-main);
  padding: 0 0.5rem;
  font-size: 0.78rem;
}

.auth-country-search::placeholder {
  color: #a07056;
}

.auth-country-empty {
  margin: 0;
  padding: 0.38rem 0.44rem;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.auth-country-options {
  max-height: min(220px, 36vh);
}

.auth-dob-picker {
  order: 0;
  margin-left: 0;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

.auth-dob-picker .due-date-field {
  height: 2rem;
  border-radius: 8px;
  padding: 0 0.36rem 0 0.5rem;
}

.auth-dob-picker .due-date-input {
  font-size: 0.84rem;
}

.auth-dob-picker .due-date-input::placeholder {
  color: #a07056;
}

.auth-dob-picker .due-date-toggle {
  width: 1.46rem;
  height: 1.46rem;
}

.auth-dob-picker .due-date-menu {
  top: calc(100% + 0.32rem);
  bottom: auto;
  left: 0;
  right: auto;
  width: 100%;
}

.auth-field-hint {
  font-size: 0.69rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.auth-field {
  display: grid;
  gap: 0.24rem;
}

.auth-field > span {
  font-size: 0.72rem;
  color: #7d4d37;
  font-weight: 700;
}

.auth-field input:not(.due-date-input):not([type="hidden"]) {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(190, 110, 66, 0.38);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--text-main);
  min-height: 2rem;
  padding: 0 0.62rem;
  font-size: 0.84rem;
  width: 100%;
}

.auth-field input[type="date"] {
  padding-right: 0.42rem;
}

.auth-field input:not(.due-date-input)::placeholder {
  color: #ab775f;
}

.auth-submit {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(190, 110, 66, 0.44);
  border-radius: 8px;
  background: #fff8f0;
  color: var(--text-main);
  min-height: 2.05rem;
  padding: 0 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: rgba(206, 109, 57, 0.65);
}

.auth-submit:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

.auth-feedback {
  min-height: 1.05rem;
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.25;
}

.auth-feedback.is-error {
  color: #9a2f2f;
}

.auth-feedback.is-success {
  color: #2d6f39;
}

.auth-feedback.is-info {
  color: #8f5a37;
}

.auth-switch-text {
  margin: 0;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.auth-link {
  color: #8b3f23;
  font-weight: 700;
  text-decoration-color: rgba(139, 63, 35, 0.45);
  text-underline-offset: 0.17em;
}

.auth-link:hover {
  text-decoration-color: currentColor;
}

.settings-shell {
  gap: clamp(0.8rem, 2.1vw, 1.35rem);
}

.settings-shell .brand-panel {
  width: min(700px, 100%);
}

.settings-session-controls {
  gap: 0.4rem;
}

.settings-back-button {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-back-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.settings-modal-open {
  overflow: hidden;
}

.settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(70, 39, 25, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 70;
}

.settings-modal-overlay[hidden] {
  display: none;
}

.settings-modal {
  width: min(400px, 100%);
  border: 1px solid rgba(170, 68, 58, 0.42);
  border-radius: var(--radius-lg);
  background: #fff3eb;
  box-shadow: var(--shadow-lg);
  padding: 0.8rem;
  display: grid;
  gap: 0.62rem;
}

.settings-modal .settings-section-title {
  font-size: 1rem;
}

.settings-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.settings-cancel-submit {
  background: #fff9f2;
  border-color: rgba(190, 110, 66, 0.44);
}

.settings-cancel-submit:hover {
  background: #ffeedd;
}

.settings-panel {
  width: min(700px, 100%);
  max-height: calc(100vh - 6.6rem);
  max-height: calc(100dvh - 6.6rem);
  overflow-y: auto;
  gap: 0.7rem;
}

.settings-section {
  border: 1px solid rgba(198, 109, 61, 0.24);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.46);
  padding: 0.72rem;
  display: grid;
  gap: 0.62rem;
}

.settings-section-header {
  display: grid;
  gap: 0.14rem;
}

.settings-section-title {
  margin: 0;
  font-size: 0.95rem;
}

.settings-section-copy {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--text-muted);
}

.settings-form {
  gap: 0.6rem;
}

.settings-account-email {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.25;
  color: #6f4534;
}

.settings-danger-section {
  border-color: rgba(170, 68, 58, 0.42);
  background: var(--danger-soft);
}

.settings-danger-submit {
  border-color: rgba(169, 55, 45, 0.56);
  background: #ffe6db;
  color: #7c251d;
}

.settings-danger-submit:hover {
  background: #ffd8cb;
  border-color: rgba(169, 55, 45, 0.74);
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0.75rem;
    gap: 0.42rem;
  }

  .brand-panel {
    padding: 0.42rem 0.65rem;
  }

  .brand-subtitle {
    font-size: 0.72rem;
  }

  .brand-mark {
    width: 1.66rem;
    height: 1.66rem;
  }

  .brand-mark-main {
    width: 1.72rem;
    height: 1.72rem;
  }

  .brand-title-main {
    font-size: clamp(1.7rem, 6.3vw, 2.08rem);
  }

  .session-controls {
    gap: 0.34rem;
  }

  .session-greeting {
    max-width: 42vw;
  }

  .task-panel {
    min-height: calc(100vh - 5.65rem);
    min-height: calc(100dvh - 5.65rem);
    max-height: calc(100vh - 5.65rem);
    max-height: calc(100dvh - 5.65rem);
    padding: 0.72rem;
    gap: 0.5rem;
  }

  .panel-header {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .task-filter-controls {
    width: auto;
    justify-content: flex-end;
  }

  .template-picker {
    width: var(--template-control-width);
    min-width: var(--template-control-width);
    flex: 0 0 var(--template-control-width);
  }

  .due-date-picker {
    margin-left: 0;
  }

  .composer {
    padding: 0.52rem;
  }

  .auth-panel {
    padding: 0.88rem;
  }

  .auth-panel-register {
    width: min(540px, 100%);
  }

  .auth-form-grid {
    grid-template-columns: 1fr;
    gap: 0.62rem;
  }

  .auth-country-picker {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
  }

  .auth-dob-picker .due-date-menu {
    width: max(100%, 16rem);
  }

  .auth-field input:not(.due-date-input):not([type="hidden"]),
  .auth-submit {
    min-height: 1.94rem;
  }

  .settings-shell .brand-panel {
    width: min(620px, 100%);
  }

  .settings-panel {
    width: min(620px, 100%);
    max-height: calc(100vh - 5.8rem);
    max-height: calc(100dvh - 5.8rem);
    gap: 0.62rem;
  }

  .settings-section {
    padding: 0.62rem;
  }

  .settings-back-button {
    width: 1.74rem;
    height: 1.74rem;
  }

  .settings-back-icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  .settings-modal {
    width: min(360px, 100%);
    padding: 0.72rem;
  }

  .settings-modal-actions {
    grid-template-columns: 1fr;
  }
}
