/* HalloFrame TODO — stile coerente con la palette Hallotech. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #e5e7eb;
  --mist: #eef2f6;
  --mist-light: #f3f5f8;
  --primary: #1f3a8a;
  --primary-soft: rgba(31, 58, 138, 0.10);
  --accent: #c4661f;
  --success: #16a34a;
  --warn: #b25b00;
  --danger: #dc2626;
  --radius: 10px;
  --transition: 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 16px 36px rgba(15, 23, 42, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
input, select, textarea, button { font: inherit; }
a { color: var(--primary); }

/* ============================================================ */
/* Login                                                         */
/* ============================================================ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fb 0%, #eef2f6 100%);
}
.login-shell { width: 100%; max-width: 380px; padding: 24px; }
.login-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-pop);
  text-align: center;
}
.brand-stack { margin-bottom: 22px; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
}
.brand-name {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-tag { color: var(--ink-soft); margin: 4px 0 0; font-size: 0.86rem; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { font-weight: 600; font-size: 0.86rem; color: var(--ink-soft); }
.login-form input {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--mist-light);
  outline: none;
  transition: border var(--transition), background var(--transition);
}
.login-form input:focus { border-color: var(--primary); background: #fff; }
.login-form button {
  margin-top: 4px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--transition);
}
.login-form button:hover { filter: brightness(0.9); }
.form-error {
  margin: 0;
  padding: 10px 12px;
  background: #fef2f2;
  color: var(--danger);
  border-radius: 8px;
  font-size: 0.86rem;
}
.login-foot { color: var(--ink-soft); margin: 14px 0 0; }

/* ============================================================ */
/* Header dashboard                                              */
/* ============================================================ */

.todo-body { background: var(--bg); }
.th-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.th-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.th-brand { display: flex; align-items: center; gap: 10px; }
.th-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}
.th-brand-name { font-weight: 800; font-size: 1.05rem; }
.th-brand-tag { color: var(--ink-soft); font-size: 0.8rem; }
.th-header-actions { display: flex; gap: 8px; align-items: center; }
.logout-form { margin: 0; }

.btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), filter var(--transition), border-color var(--transition);
}
.btn:hover { background: var(--mist-light); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { filter: brightness(0.9); background: var(--ink); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--mist-light); }

.th-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.th-toolbar input[type="search"], .th-toolbar select {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mist-light);
  outline: none;
  font-size: 0.92rem;
}
.th-toolbar input[type="search"] { min-width: 240px; flex: 1 1 240px; max-width: 360px; }
.th-toolbar input[type="search"]:focus, .th-toolbar select:focus {
  background: #fff; border-color: var(--primary);
}
.counters {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

/* ============================================================ */
/* Kanban                                                        */
/* ============================================================ */

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px 24px 24px;
}
@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .kanban { grid-template-columns: 1fr; }
}
.kcol {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px;
  min-height: 200px;
}
.kcol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.kcol-head h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}
.kcol-count {
  background: var(--mist);
  color: var(--ink-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kcol-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kcol-body:empty::before {
  content: "Nessun task";
  color: var(--ink-soft);
  font-size: 0.84rem;
  text-align: center;
  padding: 18px 0;
  font-style: italic;
}

/* ============================================================ */
/* Card TODO                                                     */
/* ============================================================ */

.todo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
}
.todo-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.todo-card.is-done { opacity: 0.66; }
.todo-card.is-done .todo-title { text-decoration: line-through; }

.todo-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.todo-check {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--success);
}
.todo-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
  word-break: break-word;
}
.todo-body {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.74rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: lowercase;
}
.badge.priority-urgent { background: #fee2e2; color: #b91c1c; }
.badge.priority-high   { background: #fff4e0; color: #b25b00; }
.badge.priority-normal { background: var(--mist); color: var(--ink-soft); }
.badge.priority-low    { background: #f1f5f9; color: #64748b; }
.badge.app-badge       { background: var(--primary-soft); color: var(--primary); }
.badge.due-soon        { background: #fff4e0; color: #b25b00; }
.badge.due-overdue     { background: #fee2e2; color: #b91c1c; }
.badge.tag             { background: #ecfdf5; color: #047857; }

/* ============================================================ */
/* Modal                                                         */
/* ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 50;
  animation: fadein 0.16s ease-out;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 51;
  display: flex;
  flex-direction: column;
  animation: popin 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes popin {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0 4px;
}
.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.modal-body input, .modal-body textarea, .modal-body select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mist-light);
  outline: none;
  color: var(--ink);
  font-weight: 400;
  transition: border var(--transition), background var(--transition);
}
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus {
  background: #fff; border-color: var(--primary);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.modal-foot #modal-delete { margin-right: auto; color: var(--danger); }

/* ============================================================ */
/* Toast                                                         */
/* ============================================================ */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
