:root {
  --bg: #fff7ec;
  --panel: #fffdf8;
  --ink: #1b1a17;
  --ink-soft: #6d6761;
  --line: #e6dccd;
  --accent: #da291c;
  --accent-soft: #f0694f;
  --warm: #ffb347;
  --danger: #a81d1d;
  --radius: 14px;
  --shadow: 0 14px 35px rgba(91, 54, 20, 0.14);
}

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

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

body {
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, #ffe9c4 0%, transparent 36%),
    radial-gradient(circle at 90% 84%, #ffe0d0 0%, transparent 30%),
    linear-gradient(145deg, #fff8ed 0%, #fff4e6 100%);
  padding: 24px;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.36;
}

.bg-shape-a {
  width: 340px;
  height: 340px;
  right: -80px;
  top: -60px;
  border-radius: 50%;
  background: conic-gradient(from 40deg, #ff8a65, #ffc16a, #ff8a65);
  filter: blur(24px);
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  left: -70px;
  bottom: -60px;
  border-radius: 38% 62% 54% 46% / 61% 51% 49% 39%;
  background: linear-gradient(145deg, #ffd783, #ff7b57);
  filter: blur(24px);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  animation: enter 380ms ease;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 95%, white 5%);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  letter-spacing: 0.2px;
}

.kicker {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.75rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.sync-badge {
  margin: 6px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  border: 1px solid #e4d6c0;
  border-radius: 999px;
  background: #fff7ec;
  color: #6f5c46;
  padding: 4px 10px;
}

.sync-badge.connected {
  border-color: #b7e0bf;
  background: #edf9ef;
  color: #1f6a35;
}

.sync-badge.error {
  border-color: #efc2c2;
  background: #fff0f0;
  color: #8e2929;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-soft));
  box-shadow: 0 8px 18px rgba(218, 41, 28, 0.24);
}

.btn-ghost {
  background: #fff7f0;
  color: #5b5248;
  border-color: #e8d6c0;
}

.btn-danger {
  background: #fee5e5;
  color: var(--danger);
  border-color: #f6b9b9;
}

.file-label {
  position: relative;
  overflow: hidden;
}

.file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.controls {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(240px, 1fr) repeat(4, minmax(170px, 1fr));
  align-items: center;
}

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  background: #fff7f0;
  border-radius: 10px;
  overflow: hidden;
}

.view-btn {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.view-btn.active {
  background: #fff;
  color: var(--accent);
}

.search-input,
.filter-select,
.task-form input,
.task-form select,
.task-form textarea {
  border: 1px solid #dacdb9;
  border-radius: 10px;
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 9px 10px;
  background: #fff;
}

.search-input:focus,
.filter-select:focus,
.task-form input:focus,
.task-form select:focus,
.task-form textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, white 70%);
  border-color: var(--accent-soft);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 10px 12px;
}

.kpi-label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.kpi-value {
  margin: 4px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.board-view {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
}

.column {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  min-height: 360px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.column.drag-over {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(240, 105, 79, 0.16);
}

.column-head {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.column-head h3 {
  margin: 0;
  font-size: 0.92rem;
}

.count-pill {
  min-width: 28px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #fff4e8;
  color: #6b4128;
  font-weight: 800;
  font-size: 0.78rem;
}

.column-body {
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.task-card {
  border: 1px solid #ebdecf;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  animation: cardIn 220ms ease;
}

.task-card[draggable="true"] {
  user-select: none;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-card:hover {
  box-shadow: 0 8px 20px rgba(91, 54, 20, 0.12);
}

.task-title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  line-height: 1.3;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.pill-assignee-angie {
  background: #ffe8e0;
  color: #8e2f12;
}

.pill-assignee-sebastian {
  background: #e5f3ff;
  color: #1a4a78;
}

.pill-assignee-julian {
  background: #ecf8e8;
  color: #2b6a2b;
}

.pill-priority-alta {
  background: #ffe2e2;
  color: #9a1f1f;
}

.pill-priority-media {
  background: #fff1dd;
  color: #85551b;
}

.pill-priority-baja {
  background: #eaf6ff;
  color: #1f567a;
}

.task-date {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.77rem;
}

.task-desc {
  margin-top: 8px;
  color: #5b5248;
  font-size: 0.78rem;
  line-height: 1.35;
}

.list-view {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #efe4d5;
  font-size: 0.9rem;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  color: #6a5f53;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #fff8ef;
  position: sticky;
  top: 0;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #fff7ed;
}

.hidden {
  display: none !important;
}

.task-dialog {
  border: 0;
  border-radius: 16px;
  width: min(780px, calc(100vw - 28px));
  padding: 0;
  box-shadow: 0 24px 60px rgba(43, 24, 9, 0.28);
}

.task-dialog::backdrop {
  background: rgba(31, 16, 9, 0.45);
  backdrop-filter: blur(2px);
}

.task-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #fff;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.icon-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  line-height: 1;
  background: #fff8f0;
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.task-form label {
  display: grid;
  gap: 5px;
  font-size: 0.85rem;
  color: #5e5348;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.sync-help {
  margin: 0;
  font-size: 0.84rem;
  color: #6a5f53;
  line-height: 1.35;
}

.empty-state {
  border: 1px dashed #d8cab6;
  border-radius: 10px;
  color: #8c7d6e;
  font-size: 0.85rem;
  text-align: center;
  padding: 20px 10px;
}

@media (max-width: 1100px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .board-view {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .board-view {
    grid-template-columns: 1fr;
  }

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

  th,
  td {
    font-size: 0.84rem;
  }
}
