:root {
  --paper: #f6f5f1;
  --paper-alt: #ffffff;
  --ink: #1f2430;
  --ink-soft: #5a5f6d;
  --line: #e3e0d8;
  --plum: #4a3f6b;
  --plum-dark: #372f52;
  --danger: #b8493f;
  --success: #3f7d6b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(31, 36, 48, 0.08), 0 4px 14px rgba(31, 36, 48, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== Auth ===== */
#view-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--paper-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand h1 { font-size: 20px; margin: 0; }

.auth-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--plum);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.auth-brand-mark.small { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--paper); border-radius: 8px; padding: 4px; }

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
}

.tab-btn.active { background: var(--plum); color: white; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-form label { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-soft); gap: 5px; }

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper-alt);
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--plum);
  outline-offset: 1px;
}

.btn-primary {
  background: var(--plum);
  color: white;
  border: none;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary:hover { background: var(--plum-dark); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 14px;
}
.btn-ghost:hover { background: var(--paper); }

.btn-danger { background: var(--danger); color: white; border: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }

.form-error { color: var(--danger); font-size: 13px; min-height: 16px; margin: 0; }
.form-hint { color: var(--ink-soft); font-size: 13px; }

/* ===== Layout principal ===== */
.topbar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--paper-alt);
  border-bottom: 1px solid var(--line);
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-right: auto; }

.btn-icon {
  border: 1px solid var(--line);
  background: var(--paper-alt);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--paper); }

.tabs-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs-nav.vertical { flex-direction: column; margin-bottom: 20px; }
.tabs-nav.vertical .nav-btn { text-align: left; }

.nav-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
}
.nav-btn.active { background: var(--plum); color: white; }

/* ===== Menú lateral (hamburguesa) ===== */
.side-menu-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 36, 48, 0.35);
  z-index: 40;
}

.side-menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 220px;
  background: var(--paper-alt);
  box-shadow: var(--shadow);
  z-index: 41;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
}

/* ===== Tabs de categoría (barra superior) ===== */
.category-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.cat-tab {
  border: 1px solid var(--line);
  background: var(--paper-alt);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
}
.cat-tab.active { color: white; border-color: transparent; }

.panel { padding: 20px; max-width: 960px; margin: 0 auto; }
.panel.hidden { display: none; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-header h2 { margin: 0; font-size: 20px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { padding: 7px 10px; font-size: 13px; }

/* ===== Agenda ===== */
.agenda-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) {
  .agenda-columns { grid-template-columns: 1fr; }
}

.agenda-col-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid var(--line);
  padding-left: 8px;
}
.agenda-col-title.atrasadas { border-color: var(--danger); }
.agenda-col-title.hoy { border-color: var(--success); }

.badge {
  background: var(--paper);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.task-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.task-card {
  background: var(--paper-alt);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border-left: 4px solid var(--plum);
  transition: transform 0.1s ease;
}
.task-card:hover { transform: translateY(-1px); }

.task-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.task-card-title { font-weight: 600; font-size: 15px; }
.task-card-meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.task-card-comment {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
}

.empty-state {
  color: var(--ink-soft);
  font-size: 14px;
  padding: 30px 10px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ===== Categorías ABM ===== */
.inline-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form input[type=text] { flex: 1; min-width: 180px; }
.inline-form input[type=color] { padding: 2px; width: 46px; height: 40px; }

.category-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper-alt);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.category-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.category-row-name { flex: 1; font-weight: 600; font-size: 14px; }

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0;
  background: var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.switch-track::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 36, 48, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-box {
  background: var(--paper-alt);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-box h3 { margin-top: 0; }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-form label { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-soft); gap: 5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.modal-actions-split { display: flex; justify-content: space-between; margin-top: 6px; flex-wrap: wrap; gap: 8px; }

.share-list { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; color: var(--ink-soft); }
