@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/source-sans-3-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/source-sans-3-latin-700.woff2") format("woff2");
}

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #23211c;
  --muted: #6f6a5e;
  --border: #ddd8cd;
  --accent: #a3410a;
  --accent-text: #8a3608;
  --focus: #1d4ed8;
  --radius: 10px;

  --font-sans: "Source Sans 3", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --weight-regular: 400;
  --weight-bold: 700;
  --line-normal: 1.45;
  --text-h1: clamp(1.5rem, 5vw, 2.1rem);
  --text-h2: 1.05rem;
  --text-body: 1rem;
  --text-meta: 0.8rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--line-normal);
  -webkit-font-smoothing: antialiased;
}

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

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(16px, 5vw, 40px) clamp(16px, 5vw, 24px) 64px;
}

.day-header {
  margin-bottom: 28px;
}

.lang-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.lang-btn {
  min-width: 36px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}

.lang-btn:hover {
  background: var(--bg);
}

.lang-btn[aria-pressed="true"] {
  border-width: 2px;
  border-color: var(--accent-text);
  background: var(--bg);
}

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

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.day-header h1 {
  margin: 0 0 16px;
  font-size: var(--text-h1);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

.day-nav {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.day-nav-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.day-nav-btn:hover {
  background: var(--bg);
}

.week-nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.week-strip {
  display: flex;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

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

.day-jump-label {
  font-size: var(--text-meta);
  color: var(--muted);
  font-weight: 600;
}

.week-day {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.week-day:hover {
  background: var(--bg);
}

.week-day-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.week-day-num {
  font-size: 0.95rem;
  font-weight: 600;
}

.week-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  visibility: hidden;
}

.week-day.has-work .week-day-dot {
  visibility: visible;
}

.week-day.is-today {
  border-width: 2px;
  border-color: var(--accent-text);
}

.week-day.is-selected {
  border-style: solid;
  border-width: 2px;
  border-color: var(--accent-text);
  background: var(--bg);
}

.week-day.is-selected .week-day-num {
  font-weight: 800;
}

.week-day.is-today.is-selected {
  border-width: 3px;
}

.panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.panel,
.notes-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.notes-panel {
  margin-top: 20px;
}

.notes-textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  resize: vertical;
  overflow-wrap: anywhere;
}

.priorities-panel {
  border-top: 4px solid var(--accent);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: var(--text-h2);
  font-weight: var(--weight-bold);
}

.panel-hint {
  font-size: var(--text-meta);
  color: var(--muted);
}

.item-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.priorities-list .item {
  border-left: 4px solid var(--accent);
}

.item-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius) 0 0 var(--radius);
}

.item-toggle:hover {
  background: var(--bg);
}

.item-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.item-time {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 3px 6px;
  border: 1px solid var(--muted);
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
}

.item-check {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--muted);
  border-radius: 5px;
  font-size: 0.85rem;
  line-height: 1;
}

.item.is-complete .item-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.item-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.item.is-complete .item-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--muted);
}

.item-delete {
  flex-shrink: 0;
  width: 40px;
  border: none;
  border-left: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.item-delete:hover {
  background: var(--bg);
  color: var(--text);
}

.add-form {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.add-form input,
.day-jump-input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  background: var(--surface);
}

.add-form input {
  flex: 1 1 160px;
  min-width: 160px;
}

.commitment-form-fields {
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.commitment-form-fields input[type='time'] {
  flex: 0 1 130px;
  min-width: 0;
}

.commitment-form-fields input[type='text'] {
  flex: 1 1 160px;
}

.add-form input:disabled {
  opacity: 0.6;
}

.add-form button {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.add-form button:hover {
  background: var(--accent-text);
}

.form-msg {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--accent-text);
  font-weight: 600;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.unfinished-panel {
  margin-top: 20px;
}

.unfinished-summary {
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.unfinished-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.unfinished-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.unfinished-origin {
  font-size: 0.78rem;
  color: var(--muted);
}

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

.unfinished-btn {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.unfinished-btn:hover {
  background: var(--bg);
}

.unfinished-complete {
  border-color: var(--accent);
  color: var(--accent-text);
}

.week-panel {
  margin-top: 20px;
}

.week-progress {
  margin-bottom: 20px;
}

.week-progress-text {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.week-goals-heading {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.upcoming-panel {
  margin-top: 20px;
}

.deadlines-summary {
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.deadlines-list .item-toggle {
  flex-wrap: wrap;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-basis: 100%;
  margin-left: 30px;
}

.item-due {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.item-urgency {
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.item.is-complete .item-urgency {
  border-color: var(--border);
  color: var(--muted);
}

.deadline-form-fields {
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.deadline-form-fields input[type='date'] {
  flex: 0 1 160px;
  min-width: 0;
}

.deadline-form-fields input[type='text'] {
  flex: 1 1 160px;
}

@media (min-width: 640px) {
  .panels {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .commitments-panel {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .page {
    max-width: 1080px;
  }

  .day-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'top switch'
      'heading heading'
      'week week'
      'jump jump';
    align-items: center;
    column-gap: 16px;
  }

  .day-header-top {
    grid-area: top;
  }

  .lang-switch {
    grid-area: switch;
    margin-bottom: 0;
  }

  .day-header h1 {
    grid-area: heading;
  }

  .week-nav {
    grid-area: week;
  }

  .day-jump {
    grid-area: jump;
    margin-top: 0;
  }

  main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 20px;
  }

  .panels {
    grid-column: 1 / -1;
  }

  .notes-panel,
  .unfinished-panel,
  .week-panel,
  .upcoming-panel {
    margin-top: 0;
  }

  .notes-panel,
  .upcoming-panel {
    grid-column: 1 / -1;
  }
}
