:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --text: #202329;
  --muted: #67707c;
  --line: #d9ded6;
  --line-strong: #b8c1b4;
  --accent: #256f68;
  --accent-dark: #174a47;
  --accent-soft: #dcece8;
  --danger: #ad2f3b;
  --warning: #9b6721;
  --shadow: 0 12px 32px rgba(32, 35, 41, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 239, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 18px;
}

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

.block-form {
  display: flex;
  gap: 8px;
  width: min(440px, 52vw);
}

.block-form input,
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
}

.block-form input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.icon-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.danger {
  color: var(--danger);
}

.main {
  flex: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  padding: 18px clamp(12px, 3vw, 28px) 28px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.kanban-wrap {
  min-width: 0;
}

.kanban-columns {
  display: grid;
  grid-auto-columns: minmax(260px, 320px);
  grid-auto-flow: column;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

kanban-block {
  display: block;
  scroll-snap-align: start;
}

.kanban-block {
  height: 100%;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.block-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.block-drag-handle {
  width: 28px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.block-drag-handle:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.block-drag-handle:active {
  cursor: grabbing;
}

.block-drag-handle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.block-head h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.item-list {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 0 0 8px 8px;
  transition: background 160ms ease, outline-color 160ms ease;
}

.item-list:empty::after {
  content: "Suelta aqui";
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}

.drop-active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

kanban-item {
  display: block;
}

.item-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  touch-action: manipulation;
}

.item-card:active {
  cursor: grabbing;
}

.item-main {
  min-width: 0;
}

.item-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
  font-size: 14px;
}

.item-description {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.item-card .icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
}

.drag-ghost {
  opacity: 0.45;
}

.drag-chosen .item-card {
  border-color: var(--accent);
}

.block-ghost {
  opacity: 0.4;
}

.block-chosen .kanban-block {
  border-color: var(--accent);
}

.calendar-shell {
  min-width: 0;
}

.calendar-weeks {
  display: grid;
  gap: 14px;
}

calendar-week {
  display: block;
  min-width: 0;
}

.week {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.week-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  min-width: 924px;
}

.week-scroll {
  overflow-x: auto;
}

calendar-day {
  display: block;
  min-width: 0;
  border-right: 1px solid var(--line);
}

calendar-day:last-child {
  border-right: 0;
}

.calendar-day {
  min-height: 178px;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.day-name {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.day-date {
  color: var(--muted);
  font-size: 12px;
}

.calendar-day.today .day-head {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.day-list {
  flex: 1;
  min-height: 136px;
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.status-line.error {
  color: var(--danger);
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

dialog {
  width: min(520px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(32, 35, 41, 0.25);
}

dialog::backdrop {
  background: rgba(32, 35, 41, 0.38);
}

.modal-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  height: 40px;
  padding: 0 11px;
}

.field textarea {
  min-height: 108px;
  resize: vertical;
  padding: 10px 11px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 720px) {
  .app-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .block-form {
    width: 100%;
  }

  .main {
    padding-inline: 10px;
  }

  .kanban-columns {
    grid-auto-columns: minmax(244px, 84vw);
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}
