:root {
  --bg: #0f1419;
  --surface: #1a2029;
  --surface-2: #232b36;
  --border: #2d3744;
  --text: #e6edf3;
  --muted: #8b98a9;
  --primary: #4f9cf9;
  --income: #3fb950;
  --expense: #f85149;
  --warn: #d29922;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 20px; font-weight: 700; padding: 16px 0; }
.tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 18px 16px; cursor: pointer; font-size: 15px; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

.logout {
  margin-left: auto; color: var(--muted); text-decoration: none; font-size: 13px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; white-space: nowrap;
  background: none; cursor: pointer; font-family: inherit;
}
.logout:hover { color: var(--text); border-color: var(--expense); }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.page-title { margin: 0 0 4px; font-size: 22px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 16px; font-size: 16px; }
.alert-card { border-color: var(--warn); border-left: 4px solid var(--warn); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 16px; }

.progress { background: var(--surface-2); border-radius: 999px; height: 10px; overflow: hidden; margin: 4px 0; }
.progress-bar { background: var(--primary); height: 100%; width: 0; transition: width .4s; }

/* Formuláře */
.tx-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1; min-width: 160px; }
.field.actions { flex-direction: row; gap: 8px; }
label { font-size: 13px; color: var(--muted); }
input, select {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 8px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.inline-form { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.inline-form.wrap { flex-wrap: wrap; align-items: flex-end; }

.btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.mini { padding: 4px 10px; font-size: 12px; }
.btn.danger-link { background: none; border: none; color: var(--expense); padding: 4px 8px; }

.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.badge.status-active { background: rgba(63,185,80,.15); color: var(--income); }
.badge.status-paused { background: rgba(210,153,34,.15); color: var(--warn); }
.badge.status-done { background: var(--surface-2); color: var(--muted); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* mini seznamy úkolů (Dnes) */
.task-mini-list { display: flex; flex-direction: column; gap: 8px; }
.task-mini { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 8px; padding: 9px 12px; }
.task-mini-title { flex: 1; }
.check {
  background: none; border: 1.5px solid var(--muted); color: var(--muted);
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; flex-shrink: 0;
}
.check:hover { border-color: var(--income); color: var(--income); }

.proj-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.due { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.due-over { background: rgba(248,81,73,.15); color: var(--expense); }
.due-today { background: rgba(210,153,34,.18); color: var(--warn); }
.due-soon { background: var(--surface); color: var(--muted); }

.proj-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.proj-mini { background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: 8px; padding: 12px 14px; }

/* karty projektů */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.proj-card {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--proj, var(--primary)); border-radius: var(--radius); padding: 18px;
}
.proj-card h3 { margin: 0; font-size: 17px; }
.proj-desc { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }

.prio { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.prio-1 { background: rgba(248,81,73,.18); color: var(--expense); }
.prio-2 { background: rgba(210,153,34,.18); color: var(--warn); }
.prio-3, .prio-4, .prio-5 { background: var(--surface-2); color: var(--muted); }

.phases { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.phase { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border-radius: 7px; padding: 8px 10px; font-size: 14px; }
.phase input { width: 16px; height: 16px; accent-color: var(--income); }
.phase.done span { text-decoration: line-through; color: var(--muted); }
.phase span { flex: 1; }
.phase-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; }
.phase-del:hover { color: var(--expense); }
.phase-add { margin-bottom: 12px; }
.phase-add input { flex: 1; }
.proj-actions { display: flex; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.kanban-col h3 { font-size: 14px; margin: 0 0 12px; color: var(--muted); }
.kanban-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.task-card { background: var(--surface-2); border-radius: 8px; padding: 11px 12px; display: flex; flex-direction: column; gap: 7px; }
.task-card-top { display: flex; gap: 6px; align-items: center; }
.task-card-title { font-weight: 500; font-size: 14px; }
.task-card-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

/* návyky */
.habit-today-list { display: flex; flex-wrap: wrap; gap: 8px; }
.habit-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.habit-chip:hover { border-color: var(--primary); }
.habit-chip.done { background: rgba(63,185,80,.16); border-color: var(--income); }
.habit-icon { font-size: 16px; }
.streak { font-size: 12px; color: var(--warn); }
.habit-list { display: flex; flex-direction: column; gap: 10px; }
.habit-row { display: flex; align-items: center; gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.habit-row .hint { flex: 1; }
.streak-big { color: var(--warn); font-size: 13px; min-width: 80px; text-align: right; }

/* ===================================================== MOBIL ===== */
@media (max-width: 760px) {
  .topbar { position: relative; flex-direction: column; align-items: stretch; gap: 0; padding: 0 12px; }
  .brand { padding: 12px 0 6px; font-size: 18px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 12px 12px; font-size: 14px; white-space: nowrap; }
  .logout { position: absolute; top: 10px; right: 12px; margin: 0; padding: 5px 10px; }

  main { padding: 16px 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .proj-grid, .proj-mini-grid { grid-template-columns: 1fr; }

  .tx-form { gap: 12px; }
  .tx-form .field, .tx-form .field.grow { flex: 1 1 100%; min-width: 0; }
  .tx-form .field.actions { flex-direction: row; }
  .inline-form { flex-wrap: wrap; }
  input, select { font-size: 16px; }
}
