:root {
  --background: #fffdf7;
  --card: #ffffff;
  --text: #40391f;
  --muted: #786f52;
  --accent: #f3d978;
  --accent-deep: #d9b94d;
  --accent-soft: #fff8e3;
  --accent-pale: #f8eab6;
  --border: #ece3c7;
  --danger: #a65750;
  --danger-soft: #fff0ee;
  --shadow: 0 8px 25px rgba(94, 81, 38, 0.07);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--background); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(217, 185, 77, 0.48);
  outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(2rem, 4vw, 2.7rem); letter-spacing: -0.045em; line-height: 1.08; }
h2 { margin-bottom: 0; font-size: 1.05rem; letter-spacing: -0.018em; }

.app-shell { width: min(100%, 1200px); margin: 0 auto; padding: 0 24px 56px; }
.app-header { position: sticky; top: 0; z-index: 10; display: flex; min-height: 68px; align-items: center; gap: 18px; margin: 0 -24px 20px; padding: 10px 24px; border-bottom: 1px solid rgba(236, 227, 199, 0.92); background: rgba(255, 253, 247, 0.96); box-shadow: 0 3px 12px rgba(94, 81, 38, 0.035); backdrop-filter: blur(10px); }
.app-name { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; margin: 0; color: #5e5126; font-size: 0.95rem; font-weight: 850; letter-spacing: 0.025em; }
.brand-mark { width: 30px; height: 30px; flex: 0 0 auto; padding: 2px; border-radius: 9px; background: var(--accent-soft); }
.brand-mark path { fill: none; stroke: var(--accent-deep); stroke-linecap: round; stroke-linejoin: round; stroke-width: 4.1; }
.top-greeting { min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 0.9rem; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.current-date { margin: 0; color: var(--muted); font: inherit; text-transform: capitalize; }
.welcome-message { margin-bottom: 15px; color: var(--muted); }
.pending-counter { display: inline-flex; gap: 5px; margin: 0; padding: 6px 11px; border-radius: 999px; color: #5e5126; background: var(--accent-soft); font-size: 0.88rem; font-weight: 750; }
.new-task-trigger { flex: 0 0 auto; min-height: 38px; margin-left: auto; padding: 7px 12px; white-space: nowrap; }

.workspace { display: block; }
.main-column { min-width: 0; }
.work-area { display: grid; gap: 24px; align-items: start; }
.work-sidebar { display: grid; min-width: 0; gap: 20px; align-content: start; }
.work-sidebar .task-creator { width: 100%; }
.work-sidebar .add-button { width: 100%; }
.work-sidebar .almanac { width: 100%; margin: 0; }
.work-sidebar .task-section + .task-section { margin-top: 0; }
.status-filter { display: grid; gap: 8px; }
.status-filter-button { display: flex; min-height: 60px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: #625a40; background: #fffefa; font-size: 0.92rem; font-weight: 780; text-align: left; }
.status-filter-button:hover { border-color: #dfc663; background: var(--accent-soft); }
.status-filter-button.is-selected { border-color: #e1bd49; color: #4b3d0e; background: var(--accent-pale); }
.status-filter-button strong { display: grid; min-width: 28px; height: 28px; place-items: center; border-radius: 999px; color: #66551d; background: rgba(255, 255, 255, 0.56); font-size: 0.8rem; }

.card, .side-card {
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.card { padding: 21px 24px; }
.side-card { padding: 18px; }

.calendar-heading, .section-manager-heading, .section-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.calendar-month { margin: 4px 0; color: #5e5126; font-size: 0.86rem; font-weight: 750; text-transform: capitalize; }
.calendar-navigation { display: flex; gap: 3px; }
.icon-button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: #fffdf8; }
.icon-button svg, .toggle-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.icon-button:hover { background: var(--accent-soft); }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.calendar-weekdays { margin-bottom: 2px; color: #948866; font-size: 0.64rem; font-weight: 750; text-align: center; }
.calendar-day, .calendar-blank { height: 24px; min-height: 24px; }
.calendar-day { position: relative; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 5px; color: var(--text); background: transparent; font-size: 0.72rem; }
.calendar-day:hover { background: var(--accent-soft); }
.calendar-day.is-today { border-color: #e4c862; color: #66551d; font-weight: 800; }
.calendar-indicators { position: absolute; bottom: 2px; display: inline-flex; gap: 2px; }
.calendar-created-marker, .calendar-completed-marker { width: 4px; height: 4px; border-radius: 50%; }
.calendar-created-marker { background: #b28a1e; }
.calendar-completed-marker { background: #80906f; }
.calendar-card { width: min(100%, 760px); padding: 12px 14px; }
.almanac { margin-bottom: 16px; padding: 12px 14px; }
.almanac .calendar-heading { min-height: 30px; margin-bottom: 7px; }
.almanac .calendar-heading > div:first-child { display: flex; align-items: baseline; gap: 9px; }
.almanac .calendar-heading h2 { font-size: 0.9rem; }
.almanac .calendar-month { margin: 0; font-size: 0.78rem; }
.almanac .calendar-weekdays, .almanac .calendar-days { column-gap: 3px; }
.almanac .calendar-weekdays { margin-bottom: 5px; row-gap: 0; font-size: 0; line-height: 1; }
.almanac .calendar-weekdays span { display: grid; min-width: 0; min-height: 16px; place-items: center; overflow: hidden; }
.almanac .calendar-weekdays span::after { color: #948866; font-size: 0.67rem; font-weight: 750; line-height: 1.1; white-space: nowrap; }
.almanac .calendar-weekdays span:nth-child(1)::after { content: "Lun"; }
.almanac .calendar-weekdays span:nth-child(2)::after { content: "Mar"; }
.almanac .calendar-weekdays span:nth-child(3)::after { content: "Mié"; }
.almanac .calendar-weekdays span:nth-child(4)::after { content: "Jue"; }
.almanac .calendar-weekdays span:nth-child(5)::after { content: "Vie"; }
.almanac .calendar-weekdays span:nth-child(6)::after { content: "Sáb"; }
.almanac .calendar-weekdays span:nth-child(7)::after { content: "Dom"; }
.almanac .calendar-days { row-gap: 3px; }
.almanac .calendar-day, .almanac .calendar-blank { height: 24px; min-height: 24px; }
.almanac .calendar-day { border-radius: 5px; font-size: 0.72rem; }

.day-summary { display: flex; flex: 0 0 auto; align-items: center; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.day-summary h2 { display: none; }
.day-summary p { display: inline-flex; align-items: baseline; gap: 4px; margin: 0; padding: 0 10px; color: var(--muted); font-size: 0.74rem; line-height: 1.2; white-space: nowrap; }
.day-summary p + p { border-left: 1px solid var(--border); }
.day-summary strong { color: #5e5126; font-size: 0.92rem; }
.section-manager { width: min(100%, 620px); padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 3px 12px rgba(94, 81, 38, 0.035); }
.section-manager-heading { align-items: center; margin-bottom: 5px; }
.section-manager-heading h2 { font-size: 0.94rem; }
.section-manager-heading .button { min-height: 31px; padding: 5px 8px; font-size: 0.76rem; }
.section-manager-list { display: grid; gap: 7px; }
.section-management-row { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 6px 0; border-bottom: 1px solid #f3edda; }
.section-management-row:last-child { border-bottom: 0; }
.section-name { min-width: 0; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; font-weight: 650; }
.section-note { color: var(--muted); font-size: 0.76rem; }

label { display: block; margin: 0 0 6px; color: #544b31; font-size: 0.88rem; font-weight: 750; }
label span { color: var(--muted); font-weight: 450; }
input, textarea, select { display: block; width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid #dfd4b4; border-radius: 9px; color: var(--text); background: #fffefa; }
textarea { min-height: 82px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9a9074; }
.form-grid, .dialog-form-grid { display: grid; gap: 12px; }
.field-wide { grid-column: 1 / -1; }
.date-field { min-width: 0; }
.inline-checkbox { display: inline-flex; width: max-content; align-items: center; gap: 7px; margin: 8px 0 0; color: var(--muted); font-size: 0.82rem; font-weight: 550; cursor: pointer; }
.inline-checkbox input { width: 16px; min-height: 16px; height: 16px; margin: 0; accent-color: #c8a93d; }
input:disabled { color: #9c9378; background: #f8f3e5; cursor: not-allowed; }

.button { min-height: 40px; padding: 8px 12px; border: 1px solid transparent; border-radius: 9px; color: var(--text); font-size: 0.88rem; font-weight: 750; }
.button-primary { border-color: #e2bf4c; background: var(--accent); }
.button-primary:hover { background: #ebcf68; }
.button-secondary { border-color: var(--border); background: #fffefa; }
.button-secondary:hover { border-color: #dfc663; background: var(--accent-soft); }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--accent-soft); color: var(--text); }
.button-text { min-height: 34px; padding: 5px 0; color: var(--danger); background: transparent; font-size: 0.82rem; }
.button-text:hover { text-decoration: underline; }
.add-button { width: 100%; margin-top: 0; }
.new-task-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }

.main-column .status-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 12px; }
.main-column .status-filter-button { min-height: 44px; padding: 7px 12px; border-color: #e8dfc9; color: #746b52; background: #fffefb; }
.main-column .status-filter-button.is-selected { border-color: #e1bd49; color: #4b3d0e; background: var(--accent-pale); }
.main-column .status-filter-button strong { min-width: 25px; height: 25px; color: #706440; background: #f6f1e3; }
.main-column .status-filter-button.is-selected strong { background: rgba(255, 255, 255, 0.62); }
.organize-controls { margin: 0 0 16px; }
.organize-controls input { min-height: 40px; padding-block: 8px; }
.filter-heading { margin: 10px 0 5px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.filter-list { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 6px; scrollbar-width: thin; }
.filter-button { min-height: 35px; flex: 0 0 auto; padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px; color: #6e6549; background: #fffefa; font-size: 0.84rem; }
.filter-button:hover { background: var(--accent-soft); }
.filter-button.is-selected { border-color: #e1bd49; color: #51420f; background: var(--accent-pale); font-weight: 750; }

.task-section { min-width: 0; }
.task-section + .task-section { margin-top: 24px; }
.section-heading { margin-bottom: 10px; }
.pending-heading { align-items: flex-end; }
.pending-title-row { display: flex; align-items: center; gap: 9px; }
.viewing-day { margin: 2px 0 0; color: var(--muted); font-size: 0.79rem; }
.list-count { display: inline-flex; align-items: center; padding: 0; color: var(--muted); background: transparent; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.list-count::before { content: "·"; margin-right: 6px; }
.today-section { margin: 0; }
.today-section .section-heading { margin-bottom: 8px; }
.week-strip { display: grid; width: min(100%, 720px); grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.week-day { position: relative; display: grid; min-height: 64px; place-items: center; align-content: center; gap: 1px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); background: #fffefa; text-align: center; }
.week-day:hover { border-color: #dfc663; background: var(--accent-soft); }
.week-day.is-today { border-color: #e4c862; color: #66551d; }
.week-day.is-selected { border-color: var(--accent-deep); color: #4b3d0e; background: var(--accent); font-weight: 750; }
.week-day-name { font-size: 0.7rem; font-weight: 750; text-transform: capitalize; }
.week-day-number { font-size: 1rem; font-weight: 800; line-height: 1.1; }
.week-day-count { display: inline-grid; min-width: 16px; height: 16px; place-items: center; border-radius: 999px; color: #66551d; background: var(--accent-soft); font-size: 0.65rem; font-weight: 800; }
.week-day.is-selected .week-day-count { color: #4b3d0e; background: rgba(255, 255, 255, 0.45); }
.workspace-utilities { display: flex; min-height: 40px; align-items: center; gap: 7px; margin: 10px 0 0; }
.utility-toggle { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; color: #625a40; background: #fffefa; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.utility-toggle:hover { border-color: #dfc663; background: var(--accent-soft); color: var(--text); }
.utility-toggle .toggle-icon { width: 16px; height: 16px; }
.utility-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }
.utility-detail { color: var(--muted); font-size: 0.72rem; font-weight: 550; text-transform: capitalize; }
.utility-panel { margin-top: 12px; }
.section-manager-panel { margin-top: 8px; }
.task-creator { width: min(100%, 760px); }
.pending-list-section { margin-top: 0; }
.task-list { display: grid; min-width: 0; gap: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 3px 12px rgba(94, 81, 38, 0.04); }
.task-card { display: grid; min-width: 0; grid-template-columns: auto minmax(0, 1fr); min-height: 82px; gap: 12px; padding: 13px 16px; border: 0; border-bottom: 1px solid #f0ead7; border-radius: 0; background: transparent; box-shadow: none; transition: background 150ms ease, min-height 180ms ease; }
.task-card:first-child { border-radius: 11px 11px 0 0; }
.task-card:last-child { border-bottom: 0; }
.task-card:last-child { border-radius: 0 0 11px 11px; }
.task-card:only-child { border-radius: 11px; }
.task-card:hover, .task-card:focus-visible { background: #fffaf0; outline: none; }
.task-checkbox { align-self: start; width: 20px; min-height: 20px; height: 20px; margin: 2px 0 0; padding: 0; accent-color: #d4af35; }
.task-content { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.task-summary { min-width: 0; padding-top: 1px; }
.task-title { margin: 0; overflow: hidden; color: var(--text); font-size: 0.96rem; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.task-detail { display: -webkit-box; margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 0.82rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; transition: max-height 180ms ease; white-space: normal; }
.task-meta { display: flex; min-width: 0; flex-direction: column; align-items: flex-end; justify-self: end; gap: 4px; margin: 0; white-space: nowrap; }
.section-tag, .date-tag, .status-date { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: 999px; font-size: 0.71rem; font-weight: 700; }
.section-tag { display: none; }
.date-tag { color: #6e6449; background: #f7f3e6; }
.status-date { color: var(--muted); background: transparent; padding-left: 0; }
.task-actions { display: flex; min-width: 0; flex-wrap: nowrap; gap: 5px; margin-left: 0; opacity: 0.72; transition: opacity 150ms ease; }
.task-card:hover .task-actions, .task-card:focus-within .task-actions { opacity: 1; }
.task-action { min-height: 27px; padding: 4px 6px; border: 0; border-radius: 6px; color: #72684e; background: transparent; cursor: pointer; font-size: 0.74rem; }
.task-action:hover { color: #5e5126; background: var(--accent-soft); }
.task-action.destructive:hover { color: var(--danger); background: var(--danger-soft); }
.task-card.is-resolved .task-title, .task-card.is-resolved .task-detail { color: #92896f; text-decoration: line-through; }
.task-card.is-deleted { opacity: 0.8; }
.status-marker { width: 20px; height: 20px; margin-top: 3px; border: 2px solid #cfbc78; border-radius: 50%; }
.task-card.is-deleted .status-marker { border-style: dashed; border-color: #b88781; }
.task-card.is-expanded { min-height: 88px; background: #fffdf7; }
.task-card.is-expanded .task-content { align-items: start; padding-top: 1px; }
.task-card.is-expanded .task-detail { display: block; height: auto; overflow: visible; -webkit-line-clamp: unset; text-overflow: clip; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-card.is-expanded .task-actions { opacity: 1; }

.work-sidebar .task-content { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.work-sidebar .task-meta { align-items: flex-start; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; white-space: normal; }
.work-sidebar .task-actions { flex-wrap: wrap; max-width: 100%; }
.empty-state { margin: 0; padding: 21px 16px; border: 1px dashed #dccfa9; border-radius: 12px; color: var(--muted); background: #fffefb; text-align: center; }

.collapsible-heading { margin-bottom: 0; }
.section-toggle { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 0; border: 0; color: var(--text); background: transparent; font-size: 1.04rem; font-weight: 780; letter-spacing: -0.018em; }
.section-count { display: inline-grid; min-width: 24px; height: 24px; place-items: center; border-radius: 999px; color: #66551d; background: var(--accent-soft); font-size: 0.76rem; letter-spacing: 0; }
.toggle-icon { flex: 0 0 auto; color: var(--muted); transition: transform 150ms ease; }
.section-toggle[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }
#history-content, #trash-content { margin-top: 12px; }

dialog { width: min(calc(100% - 32px), 560px); max-height: calc(100vh - 32px); overflow: auto; padding: 23px; border: 1px solid var(--border); border-radius: 15px; color: var(--text); box-shadow: 0 18px 55px rgba(65, 54, 21, 0.22); }
dialog::backdrop { background: rgba(64, 57, 31, 0.37); }
.dialog-heading h2 { margin: 0; }
.close-button { display: grid; width: 36px; height: 36px; place-items: center; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 1.7rem; line-height: 1; }
.close-button:hover { color: var(--text); background: var(--accent-soft); }
dialog label:not(.inline-checkbox) { margin-top: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }

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

@media (min-width: 620px) {
  .form-grid, .dialog-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .add-button { width: auto; min-width: 168px; }
}

@media (min-width: 920px) {
  .app-shell { padding-bottom: 64px; }
  .work-area { grid-template-columns: 320px minmax(0, 1fr); }
  .work-sidebar { position: static; }
  .task-creator { padding: 22px 24px; }
}

@media (max-width: 460px) {
  .app-shell { padding: 0 15px 42px; }
  .app-header { gap: 9px; margin: 0 -15px 16px; padding: 9px 15px; }
  .app-name span { display: none; }
  .top-greeting { font-size: 0.78rem; }
  .current-date { display: none; }
  .new-task-trigger { min-height: 34px; padding: 6px 8px; font-size: 0.76rem; }
  .card, .side-card { padding: 17px; }
  .workspace-utilities { flex-wrap: wrap; }
  .day-summary { width: 100%; }
  .day-summary p { padding: 0 6px; font-size: 0.7rem; }
  .utility-toggle { min-height: 32px; font-size: 0.74rem; }
  .utility-detail { display: none; }
  .week-strip { gap: 4px; }
  .week-day { min-height: 58px; padding: 4px 2px; }
  .section-manager-heading { align-items: center; }
  .task-meta { align-items: flex-start; }
  .task-actions { width: 100%; margin-left: 0; }
  .new-task-actions { flex-direction: column-reverse; }
  .new-task-actions .button { width: 100%; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
