:root {
  --bg: #e4ddd5;
  --bg-soft: rgba(255, 255, 255, 0.42);
  --surface: rgba(248, 244, 239, 0.76);
  --surface-strong: rgba(255, 250, 246, 0.82);
  --text: #2f2a27;
  --text-muted: #6c645d;
  --accent: #67766d;
  --priority-high: #a35d4d;
  --priority-medium: #8a948e;
  --priority-low: transparent;
  --category-personal: #d4ccbd;
  --category-work: #67766d;
  --border-soft: rgba(47, 42, 39, 0.08);
  --shadow-soft: 0 18px 40px rgba(47, 42, 39, 0.07);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --font-heading: "Cormorant Garamond", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --app-max-width: 1440px;
  --bg-image: url("./background.jpg");
  --bg-overlay:
    linear-gradient(180deg, rgba(255, 252, 249, 0.2) 0%, rgba(228, 221, 213, 0.72) 100%),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0) 38%);
}

body.theme-bg-0 {
  --bg-image: url("./background.jpg");
}

body.theme-bg-1 {
  --bg-image: url("./background1.jpg");
}

body.theme-bg-2 {
  --bg-image: url("./background2.jpg");
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-overlay), var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(100%, var(--app-max-width));
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.appearance-toggle {
  position: absolute;
  top: 28px;
  right: 24px;
  z-index: 20;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.9);
  box-shadow: var(--shadow-soft);
}

.logout-button {
  position: absolute;
  top: 28px;
  right: 176px;
  z-index: 20;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.9);
  box-shadow: var(--shadow-soft);
}

.password-button {
  position: absolute;
  top: 28px;
  right: 276px;
  z-index: 20;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.9);
  box-shadow: var(--shadow-soft);
}

.logout-button[hidden] {
  display: none;
}

.password-button[hidden] {
  display: none;
}

.auth-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 72px 20px;
  display: flex;
  align-items: center;
}

.auth-card {
  width: 100%;
  padding: 32px;
}

.auth-card h1 {
  margin: 8px 0 12px;
  font-family: var(--font-heading);
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  line-height: 1;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 26px;
}

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

.auth-message {
  min-height: 24px;
  margin: 0;
  color: var(--priority-high);
  line-height: 1.5;
}

.appearance-panel {
  position: absolute;
  top: 86px;
  right: 24px;
  z-index: 20;
  width: min(320px, calc(100vw - 40px));
}

.panel-card,
.surface-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 248, 242, 0.08) 100%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel-card {
  padding: 22px;
}

.panel-card h2,
.planner-header h1,
.section-heading h2,
.task-item h3,
.archive-item h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1;
}

.panel-card h2 {
  font-size: 2rem;
  margin-top: 6px;
}

.panel-copy,
.lead,
.current-date,
.view-subtitle,
.task-item p,
.archive-item p,
.view-tile p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.background-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.background-option,
.ghost-button,
.text-button {
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.72);
}

.background-option.is-active {
  color: #f9f5f0;
  background: var(--accent);
  border-color: transparent;
}

.ghost-button,
.text-button {
  background: rgba(255, 250, 246, 0.55);
}

.text-button {
  min-width: 88px;
  background: transparent;
  color: var(--accent);
}

.text-button.is-current-view {
  color: #f9f5f0;
  background: var(--accent);
  border-color: transparent;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.72fr);
  gap: 24px;
  align-items: start;
}

.planner-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.planner-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
}

.planner-header h1 {
  font-size: clamp(3.2rem, 6vw, 5rem);
  margin-top: 10px;
}

.planner-title-row {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.current-date {
  margin-top: 12px;
}

.planner-year-control {
  position: absolute;
  top: 96px;
  right: 24px;
  z-index: 19;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.planner-year-shell {
  padding: 10px 12px 10px 16px;
}

.eyebrow,
.stat-label,
.view-label,
.priority-chip,
.archive-item time,
.task-item time {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.eyebrow,
.stat-label,
.archive-item p,
.archive-item time,
.task-item time {
  color: var(--text-muted);
}

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

.stat-card {
  padding: 22px 24px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.3rem;
  font-weight: 600;
}

.progress-stat {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
}

.progress-ring-svg {
  width: 62px;
  height: 62px;
  transform: rotate(-90deg);
}

.progress-ring-track,
.progress-ring-value {
  fill: none;
  stroke-width: 4;
}

.progress-ring-track {
  stroke: rgba(47, 42, 39, 0.1);
}

.progress-ring-value {
  stroke: #5f7b65;
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: 113.1;
  transition: stroke-dashoffset 220ms ease;
}

.progress-ring-text {
  position: absolute;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.tasks-card,
.board-card,
.archive-shell {
  padding: 28px;
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 246, 0.5);
}

.task-form-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 2fr)
    minmax(180px, 1.05fr)
    minmax(112px, 0.72fr)
    minmax(138px, 0.95fr)
    minmax(138px, 0.95fr);
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-input {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(47, 42, 39, 0.12);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.92);
}

.field-input-date {
  width: 100%;
  min-width: 0;
  padding-right: 42px;
  font-variant-numeric: tabular-nums;
}

.field-input-time {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding-right: 16px;
  font-variant-numeric: tabular-nums;
}

.field-input:focus {
  outline: 2px solid rgba(103, 118, 109, 0.24);
  border-color: var(--accent);
}

.task-form-submit {
  align-self: flex-start;
  color: #345a42;
  background: #dbead7;
  border-color: rgba(95, 123, 101, 0.22);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.section-heading h2 {
  font-size: 2.4rem;
  margin-top: 6px;
}

.task-list,
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#main-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-subtitle {
  margin-top: 10px;
}

.day-view,
.week-view,
.month-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.week-column,
.month-cell {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 246, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 0 0 1px rgba(47, 42, 39, 0.05),
    0 14px 30px rgba(47, 42, 39, 0.1);
}

.week-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
  padding: 16px;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.week-column.is-drop-target {
  border-color: rgba(103, 118, 109, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(103, 118, 109, 0.08) 100%),
    rgba(255, 250, 246, 0.9);
  box-shadow: inset 0 0 0 1px rgba(103, 118, 109, 0.12);
}

.week-column-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-column-title,
.month-cell-day {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
}

.week-column-date,
.month-cell-meta,
.month-task-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.week-task-card {
  padding: 12px;
  border-radius: 14px;
  border-left: 3px solid var(--priority-low);
  background: var(--surface-strong);
  cursor: grab;
}

.week-task-card.priority-high {
  border-left-color: var(--priority-high);
}

.week-task-card.priority-medium {
  border-left-color: var(--priority-medium);
}

.week-task-card.is-completed {
  opacity: 0.62;
}

.week-task-card.is-dragging,
.archive-item.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.week-task-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.1;
}

.week-task-card p {
  margin: 0;
  color: var(--text-muted);
}

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

.month-cell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.month-cell.is-outside {
  opacity: 0.48;
}

.month-cell.is-selected {
  border-color: rgba(103, 118, 109, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(103, 118, 109, 0.08) 100%),
    rgba(255, 250, 246, 0.92);
}

.month-cell-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.month-cell-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.month-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

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

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

.month-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}

.date-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.nav-mode-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.nav-mode-group[hidden] {
  display: none;
}

.date-input-shell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.68);
}

.date-input-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-date-input {
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.nav-year-input {
  min-width: 136px;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 600;
}

.task-item,
.archive-item,
.view-tile {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 0 1px rgba(47, 42, 39, 0.06),
    0 14px 28px rgba(47, 42, 39, 0.1);
}

.task-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-left: 4px solid var(--priority-low);
}

.task-item.is-completed {
  opacity: 0.62;
}

.task-item.is-completed h3 {
  text-decoration: line-through;
}

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

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

.task-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-shell {
  display: flex;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 6px;
  accent-color: var(--accent);
}

.category-chip,
.priority-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 8px 12px;
  border-radius: 999px;
}

.category-chip {
  color: var(--text);
  border: 1px solid transparent;
}

.category-work {
  color: #3c5872;
  border-color: rgba(129, 171, 214, 0.28);
  background: #dbeaf9;
}

.category-personal {
  color: #8b5668;
  border-color: rgba(226, 172, 193, 0.28);
  background: #f5dee7;
}

.priority-chip {
  font-weight: 600;
  border: 2px solid currentColor;
  background: rgba(255, 255, 255, 0.92);
}

.task-item.priority-high .priority-chip,
.week-task-card.priority-high .priority-chip {
  font-weight: 700;
  color: #c94933;
}

.task-item.priority-medium .priority-chip,
.week-task-card.priority-medium .priority-chip {
  color: #b58d1f;
}

.task-item.priority-low .priority-chip,
.week-task-card.priority-low .priority-chip {
  color: #5f7b65;
}

.task-item h3,
.archive-item h3 {
  font-size: 1.6rem;
  line-height: 1.1;
}

.task-item time {
  white-space: nowrap;
  align-self: flex-start;
}

.task-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

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

.task-icon-button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.72);
}

.task-title-button {
  padding: 0;
  border: 0;
  text-align: left;
  color: inherit;
  background: transparent;
}

.task-title-button:hover {
  color: var(--accent);
}

.task-title-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(47, 42, 39, 0.12);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.96);
}

.inline-edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(47, 42, 39, 0.1);
  border-radius: 18px;
  background: rgba(255, 250, 246, 0.88);
}

.inline-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

.inline-edit-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-edit-title {
  width: 100%;
}

.week-task-card.is-editing {
  padding: 0;
  border-left-width: 3px;
  cursor: default;
  overflow: hidden;
}

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

.view-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
  padding: 18px;
  justify-content: flex-end;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(103, 118, 109, 0.06) 100%),
    var(--surface-strong);
}

.view-label {
  color: var(--accent);
}

.archive-shell {
  position: sticky;
  top: 24px;
}

.archive-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: 999px;
  color: #f9f5f0;
  background: #7f3f34;
}

.archive-notice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid rgba(103, 118, 109, 0.18);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(103, 118, 109, 0.08) 100%),
    rgba(255, 250, 246, 0.76);
}

.archive-notice[hidden] {
  display: none;
}

.archive-notice h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 600;
}

.archive-notice p,
.archive-caption {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.archive-notice-actions,
.archive-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.archive-toolbar {
  margin-bottom: 18px;
}

.archive-clear-button {
  flex-shrink: 0;
}

.archive-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  cursor: grab;
}

.archive-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

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

.archive-action-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.72);
}

.archive-title-button {
  padding: 0;
  border: 0;
  text-align: left;
  color: inherit;
  background: transparent;
}

.archive-title-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(47, 42, 39, 0.12);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 250, 246, 0.96);
}

.empty-state {
  padding: 24px;
  border: 1px dashed rgba(47, 42, 39, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 246, 0.48);
}

.empty-state h3 {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .app-layout,
  .planner-grid {
    grid-template-columns: 1fr;
  }

  .week-grid,
  .month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-shell {
    position: static;
  }
}

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .page-shell {
    padding: 88px 16px 28px;
  }

  .appearance-toggle {
    top: 22px;
    right: 16px;
  }

  .logout-button {
    top: 22px;
    right: 154px;
  }

  .password-button {
    top: 72px;
    right: 16px;
  }

  .appearance-panel {
    top: 122px;
    right: 16px;
  }

  .planner-year-control {
    position: absolute;
    top: 78px;
    right: 16px;
  }

  .planner-header,
  .tasks-card,
  .board-card,
  .archive-shell {
    padding: 22px;
  }

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

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

  .planner-header,
  .task-item,
  .archive-item,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .planner-title-row {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .task-shell,
  .task-side {
    width: 100%;
  }

  .task-side {
    align-items: flex-start;
  }

  .archive-notice-actions,
  .archive-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .planner-overview,
  .view-grid {
    grid-template-columns: 1fr;
  }

  .week-grid,
  .month-grid {
    grid-template-columns: 1fr;
  }
}
