/* ------------------------------------------------------------------
   CK DAKA – Úlohy
   Firemné farby: tmavomodrá #1B3563, zelená #659A40
------------------------------------------------------------------ */

:root {
  --navy: #1b3563;
  --navy-600: #24427a;
  --navy-300: #5b719d;
  --green: #659a40;
  --green-600: #568536;
  --green-100: #eaf3e3;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e2e6ee;
  --text: #1d2330;
  --text-dim: #67708a;
  --brand: var(--navy);
  --on-brand: #ffffff;

  --red: #c3402f;
  --amber: #c67a12;
  --blue: #2f6fb0;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 53, 99, .06), 0 6px 18px rgba(27, 53, 99, .07);
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html[data-theme='dark'] {
  --bg: #10141d;
  --surface: #182031;
  --surface-2: #1f293c;
  --border: #2a3548;
  --text: #e8ecf5;
  --text-dim: #9aa5bd;
  --navy: #2d4d86;
  --navy-600: #35589a;
  --navy-300: #7f95c1;
  --green: #7cb452;
  --green-600: #6ea247;
  --green-100: #22311c;
  --brand: #16233a;
  --red: #e5705f;
  --amber: #e0a13f;
  --blue: #6ba4de;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-600); }
html[data-theme='dark'] a { color: var(--navy-300); }

/* ----------------------------- Layout ----------------------------- */

#app { min-height: 100%; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 10px rgba(27, 53, 99, .18);
}

.app-header .mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: 0 0 auto;
}

.app-header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header .sub {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  opacity: .75;
  letter-spacing: .3px;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}
.icon-btn:active { transform: scale(.94); }

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

main {
  padding: 14px 14px calc(var(--nav-h) + var(--safe-b) + 24px);
  max-width: 720px;
  margin: 0 auto;
}

/* --------------------------- Bottom nav --------------------------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(8px);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
}
.bottom-nav a.active { color: var(--navy-600); }
html[data-theme='dark'] .bottom-nav a.active { color: var(--navy-300); }
.bottom-nav svg { width: 22px; height: 22px; }

.bottom-nav .fab-slot { position: relative; }
.bottom-nav .fab {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(101, 154, 64, .4);
  text-decoration: none;
}
.bottom-nav .fab svg { width: 26px; height: 26px; }
.bottom-nav .fab:active { transform: translateX(-50%) scale(.94); }

.nav-badge {
  position: absolute;
  top: 2px;
  left: 55%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
}

/* ----------------------------- Karty ------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.card.tight { padding: 0; overflow: hidden; }

h2.section-title {
  margin: 20px 4px 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
}
h2.section-title:first-child { margin-top: 4px; }

.hello { margin: 2px 0 14px; }
.hello h2 { margin: 0; font-size: 21px; font-weight: 700; }
.hello p { margin: 2px 0 0; color: var(--text-dim); font-size: 13.5px; }

/* --------------------------- Prepínače ---------------------------- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---------------------------- Prehľad ----------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.stat b { display: block; font-size: 22px; line-height: 1.15; }
.stat span { font-size: 11.5px; color: var(--text-dim); font-weight: 600; }
.stat.is-red b { color: var(--red); }
.stat.is-amber b { color: var(--amber); }
.stat.is-green b { color: var(--green); }
.stat.is-navy b { color: var(--navy-600); }
html[data-theme='dark'] .stat.is-navy b { color: var(--navy-300); }

/* ----------------------------- Úlohy ------------------------------ */

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

.task {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.task.p-urgent { border-left-color: var(--red); }
.task.p-high   { border-left-color: var(--amber); }
.task.p-normal { border-left-color: var(--navy-300); }
.task.p-low    { border-left-color: var(--border); }
.task.done .task-title { text-decoration: line-through; color: var(--text-dim); }

.tick {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  margin-top: 1px;
  border: 2px solid var(--navy-300);
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.tick svg { width: 15px; height: 15px; opacity: 0; color: #fff; }
.tick.on { background: var(--green); border-color: var(--green); }
.tick.on svg { opacity: 1; }

.task-body { min-width: 0; flex: 1; }
.task-title { font-weight: 600; word-break: break-word; }
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
.pill.branch { background: var(--green-100); border-color: transparent; color: var(--green-600); }
html[data-theme='dark'] .pill.branch { color: var(--green); }
.pill.urgent { background: rgba(195, 64, 47, .12); border-color: transparent; color: var(--red); }
.pill.high { background: rgba(198, 122, 18, .13); border-color: transparent; color: var(--amber); }
.pill.overdue { background: rgba(195, 64, 47, .12); border-color: transparent; color: var(--red); }
.pill.today { background: rgba(47, 111, 176, .13); border-color: transparent; color: var(--blue); }

/* ---------------------------- Zoznamy ----------------------------- */

.row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  text-align: left;
}
.row-link:last-child { border-bottom: 0; }
.row-link .emoji { font-size: 21px; width: 26px; text-align: center; }
.row-link .grow { flex: 1; min-width: 0; }
.row-link .grow b { display: block; font-weight: 600; }
.row-link .grow small { color: var(--text-dim); font-size: 12px; }
.row-link .count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--text-dim);
}
.row-link .count.hot { background: var(--navy); border-color: var(--navy); color: #fff; }
.row-link .chev { color: var(--text-dim); }

/* --------------------------- Formuláre ---------------------------- */

.field { margin-bottom: 13px; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
}

input[type='text'], input[type='email'], input[type='password'],
input[type='date'], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2367708a' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 34px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--navy-300);
  box-shadow: 0 0 0 3px rgba(91, 113, 157, .18);
}

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  padding: 9px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.seg button.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.seg button.active[data-value='urgent'] { background: var(--red); border-color: var(--red); }
.seg button.active[data-value='high'] { background: var(--amber); border-color: var(--amber); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.navy { background: var(--navy); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > * { flex: 1; min-width: 130px; }

/* --------------------------- Prihlásenie -------------------------- */

.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: 430px;
  margin: 0 auto;
}
.login-logo {
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.login-logo img { width: 100%; display: block; }
.login-wrap h2 { margin: 0 0 4px; font-size: 20px; }
.login-wrap p.lead { margin: 0 0 18px; color: var(--text-dim); font-size: 13.5px; }

/* ---------------------------- Komentáre --------------------------- */

.comment {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: 0; }
.comment .who { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
.comment .who b { color: var(--text); font-size: 13px; }
.comment .text { white-space: pre-wrap; word-break: break-word; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.photo-grid figure { margin: 0; position: relative; }
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
.photo-grid button.del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

/* -------------------------- Notifikácie --------------------------- */

.note { display: flex; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.note:last-child { border-bottom: 0; }
.note.unread { background: var(--green-100); }
html[data-theme='dark'] .note.unread { background: rgba(124, 180, 82, .09); }
.note .dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-top: 6px; }
.note.read .dot { background: var(--border); }
.note .grow { flex: 1; min-width: 0; }
.note b { display: block; font-size: 14px; }
.note p { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); word-break: break-word; }
.note time { display: block; margin-top: 4px; font-size: 11px; color: var(--text-dim); }

/* ------------------------------ Ostatné --------------------------- */

.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--text-dim);
}
.empty .big { font-size: 34px; margin-bottom: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%) translateY(20px);
  z-index: 90;
  max-width: 90vw;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}

.inline-note {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--green-100);
  color: var(--green-600);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
html[data-theme='dark'] .inline-note { color: var(--green); }
.inline-note.warn { background: rgba(198, 122, 18, .14); color: var(--amber); }
.inline-note.err { background: rgba(195, 64, 47, .12); color: var(--red); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; }
.kv + .kv { border-top: 1px dashed var(--border); }
.kv span { color: var(--text-dim); }
.kv b { font-weight: 600; text-align: right; }

.spinner {
  width: 26px;
  height: 26px;
  margin: 40px auto;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 620px) {
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ------------------------------------------------------------------
   Hľadanie
------------------------------------------------------------------ */

.search-open {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--surface); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow);
}
.search-open svg { width: 18px; height: 18px; flex: none; }
.search-open:hover { color: var(--text); }

.search-field { margin-bottom: 14px; }
.search-field input { font-size: 16px; }

.result-count {
  margin: 0 0 10px; color: var(--text-dim); font-size: 13px; font-weight: 600;
}

/* ------------------------------------------------------------------
   Odškrtávací zoznam
------------------------------------------------------------------ */

.checklist { display: flex; flex-direction: column; }

.check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.check-row:last-child { border-bottom: 0; }
.check-row .grow { flex: 1; font-size: 14.5px; line-height: 1.45; }
.check-row.done .grow { color: var(--text-dim); text-decoration: line-through; }

.tick.sm { width: 24px; height: 24px; flex: none; }
.tick.sm svg { width: 14px; height: 14px; }

.check-row .del {
  border: 0; background: none; color: var(--text-dim);
  font-size: 20px; line-height: 1; padding: 0 4px; cursor: pointer; opacity: .55;
}
.check-row .del:hover { opacity: 1; color: var(--red); }

.pill.ok { background: var(--green-100); color: var(--green-600); }

/* ------------------------------------------------------------------
   Prílohy typu dokument
------------------------------------------------------------------ */

.file-list { display: flex; flex-direction: column; }

.file-row {
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: 0; }
.file-row > a {
  display: flex; align-items: center; gap: 11px; flex: 1;
  padding: 10px 0; color: inherit; text-decoration: none; min-width: 0;
}
.file-row .emoji { font-size: 20px; flex: none; }
.file-row .grow { min-width: 0; }
.file-row b {
  display: block; font-size: 14.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-row small { display: block; color: var(--text-dim); font-size: 12.5px; }
.file-row .del {
  border: 0; background: none; color: var(--text-dim);
  font-size: 20px; padding: 0 4px; cursor: pointer; opacity: .55;
}
.file-row .del:hover { opacity: 1; color: var(--red); }

/* ------------------------------------------------------------------
   Prepínače v nastaveniach
------------------------------------------------------------------ */

.switch-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.switch-row:last-of-type { border-bottom: 0; }
.switch-row .grow { flex: 1; }
.switch-row b { display: block; font-size: 14.5px; font-weight: 600; }
.switch-row small { display: block; color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }

.switch {
  flex: none; width: 46px; height: 27px; padding: 0;
  border: 0; border-radius: 999px; background: var(--border);
  position: relative; cursor: pointer; transition: background .18s ease;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s ease;
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(19px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* ------------------------------------------------------------------
   Označenie kolegu, nápoveda, textové tlačidlo
------------------------------------------------------------------ */

.mention {
  color: var(--navy-600); font-weight: 600;
  background: var(--green-100); border-radius: 5px; padding: 0 3px;
}
html[data-theme='dark'] .mention { color: var(--navy-300); }

.hint { display: block; margin-top: 6px; color: var(--text-dim); font-size: 12.5px; }

.link-btn {
  display: block; margin: 14px auto 0; padding: 6px;
  background: none; border: 0; color: var(--navy-600);
  font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer;
}
html[data-theme='dark'] .link-btn { color: var(--navy-300); }

.inline-note.ok {
  background: var(--green-100); color: var(--green-600);
  border: 1px solid transparent;
}
