:root {
  --paper: #F7F5F0;
  --surface: #FFFFFF;
  --ink: #1F2A24;
  --ink-muted: #6B7A72;
  --teal: #0F6B5C;
  --teal-dark: #0A4F44;
  --rust: #C2571B;
  --line: #E4E0D6;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* LOGIN */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 2px 24px rgba(31, 42, 36, 0.08);
  border: 1px solid var(--line);
}

.stamp-mark {
  font-size: 40px;
  margin-bottom: 8px;
}

.login-title {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  margin: 0 0 6px;
}

.login-sub {
  color: var(--ink-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

#login-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 15px;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
}

.btn {
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: var(--teal);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.error-text {
  color: var(--rust);
  font-size: 13px;
  min-height: 18px;
  margin-top: 6px;
}

/* LAYOUT */
#app-screen,
#home-screen,
#tasks-screen,
#kanban-screen,
#settings-screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.top-nav {
  margin-bottom: 12px;
}

.back-home {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.home-header {
  margin-bottom: 24px;
}

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

.today-date {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  margin: 0;
  text-transform: capitalize;
}

.header-right {
  text-align: right;
}

.live-clock {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  color: var(--teal-dark);
}

.link-btn {
  display: block;
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 13px;
  margin-top: 6px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* HOME */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.home-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.12s ease, border-color 0.12s ease;
  font-family: 'Inter', sans-serif;
}

.home-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.home-icon {
  font-size: 26px;
}

.home-title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  color: var(--ink);
}

.home-desc {
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.4;
}

/* PLACEHOLDERS */
.placeholder-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.placeholder-badge {
  background: var(--paper);
  color: var(--teal-dark);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}

.placeholder-icon {
  font-size: 42px;
  margin-bottom: 8px;
}

.placeholder-title {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  margin: 0 0 10px;
}

.placeholder-desc {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
  max-width: 420px;
  margin: 0;
}

/* TABS */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 6px;
  margin-right: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}

/* LIVE SUMMARY */
.live-summary {
  margin-bottom: 16px;
}

.live-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.live-item {
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 12px;
}

.live-label {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.live-item strong {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--teal-dark);
}

.target-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.target-row label {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 600;
}

.target-row input {
  width: 80px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
}

.target-row .btn {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
}

/* PUNCH */
.punch-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  margin-bottom: 16px;
}

.status-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 18px;
}

.punch-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 30%, var(--teal), var(--teal-dark));
  color: white;
  font-family: 'Fraunces', serif;
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 107, 92, 0.35), inset 0 2px 4px rgba(255,255,255,0.25);
  transition: transform 0.12s ease;
}

.punch-btn:active {
  transform: scale(0.96);
}

.punch-btn:disabled {
  background: #CBD3CE;
  box-shadow: none;
  cursor: not-allowed;
}

.complete-msg {
  margin-top: 16px;
  color: var(--teal-dark);
  font-weight: 600;
}

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  margin: 0 0 14px;
}

/* TIMELINE */
.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.timeline-list li:last-child {
  border-bottom: none;
}

.timeline-time {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--teal-dark);
  font-weight: 600;
}

.timeline-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 6px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--paper);
}

.timeline-empty {
  color: var(--ink-muted);
  font-size: 14px;
  text-align: center;
  padding: 10px 0;
}

/* TOTAL */
.total-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-label {
  font-size: 14px;
  color: var(--ink-muted);
  font-weight: 600;
}

.total-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--teal-dark);
}

/* HISTORIAL */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
}

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

.history-actions .btn {
  width: auto;
  padding: 9px 14px;
  font-size: 13px;
}

.sync-msg {
  font-size: 13px;
  color: var(--teal-dark);
  min-height: 18px;
  margin-bottom: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

td {
  font-family: 'IBM Plex Mono', monospace;
}

@media (max-width: 420px) {
  .punch-btn {
    width: 140px;
    height: 140px;
    font-size: 17px;
  }

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

/* ============================================
   BLOQUE 3B TASKS
   ============================================ */
.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

.screen-title {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  margin: 0;
}

.tasks-new-btn {
  width: auto;
  padding: 10px 14px;
}

.tasks-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tasks-toolbar select {
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.task-contact {
  font-weight: 600;
  font-size: 16px;
}

.task-meta {
  color: var(--ink-muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.task-desc {
  font-size: 14px;
  color: var(--ink);
  white-space: pre-wrap;
  margin-bottom: 10px;
}

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

.task-actions .btn {
  width: auto;
  padding: 8px 10px;
  font-size: 13px;
}

.badge {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-baja {
  background: #EEF2F0;
  color: #516B5F;
  border-color: #D7E0DB;
}

.badge-media {
  background: #FDF3E7;
  color: #9A6A1D;
  border-color: #F0DFC3;
}

.badge-alta {
  background: #FDEEE3;
  color: #B4510F;
  border-color: #F4D4BE;
}

.badge-critica {
  background: #FBE9E7;
  color: #B3261E;
  border-color: #F3C1BC;
}

.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--ink);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#task-form-view .btn-primary {
  margin-top: 6px;
}

.btn-danger {
  background: #B3261E;
  color: white;
  width: auto;
  margin-top: 10px;
}

.note-add-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 12px;
}

.note-add-row textarea {
  flex: 1;
  width: auto;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

.note-item {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.note-item:last-child {
  border-bottom: none;
}

.note-date {
  color: var(--ink-muted);
  font-size: 12px;
  display: block;
  margin-top: 4px;
}

.task-empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 24px 0;
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   BLOQUE 4 KANBAN
   ============================================ */
.kanban-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: start;
}

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

.kanban-column {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 200px;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-muted);
  padding: 6px 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.kanban-count {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.kanban-column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  transition: box-shadow 0.12s ease;
}

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

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(31,42,36,0.08);
}

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.kanban-card-contact {
  font-weight: 600;
  font-size: 14px;
}

.kanban-card-score {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--paper);
  border-radius: 6px;
  padding: 2px 6px;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.kanban-card-desc {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
}

.kanban-card-actions {
  display: flex;
  gap: 6px;
}

.kanban-card-actions .btn {
  width: auto;
  padding: 6px 8px;
  font-size: 12px;
}

.kanban-empty {
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

#kanban-sort-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

/* ============================================
   BLOQUE 5 CALENDAR
   ============================================ */
.calendar-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.calendar-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.calendar-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.calendar-status.connected {
  color: var(--teal-dark);
}

.calendar-banner .btn {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
}

.calendar-banner select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  max-width: 220px;
}

.calendar-sync-all-btn {
  background: var(--teal);
  color: white;
}

/* ============================================
   BLOQUE 6 APARIENCIA
   ============================================ */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-muted);
}

.settings-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}

.color-picker-wrap input[type="color"] {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--line);
  border-radius: 6px;
}

.color-picker-wrap span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--ink);
}

.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-btn {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.15s ease;
}

.radio-btn.active {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.gradient-inputs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#save-theme-btn {
  margin-top: 10px;
  width: 100%;
}

.theme-preview {
  height: 80px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-top: 10px;
  transition: all 0.3s ease;
}

/* Logo WorkHub en login */
.stamp-logo {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 2px 10px rgba(31, 42, 36, 0.12);
}
