﻿:root {
  --blue: #0053a0;
  --blue-dark: #003c75;
  --blue-soft: #e8f0f9;
  --yellow: #fecc00;
  --yellow-soft: #fff6d6;
  --white: #ffffff;
  --ink: #16212c;
  --muted: #5d6f80;
  --line: #d9e2ec;
  --ok: #1d7a4c;
  --ok-soft: #e4f4ea;
  --warn: #9a6400;
  --warn-soft: #fff2d2;
  --danger: #b4231f;
  --danger-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 60, 117, 0.08);
}

* {
  box-sizing: border-box;
}

/* Atribút hidden musí prebiť layoutové display pravidlá (.stack, .card, ...). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--blue-dark);
  line-height: 1.25;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
  margin-top: 20px;
}

p {
  margin: 6px 0;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: var(--blue);
  color: var(--white);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue-dark);
  overflow: hidden;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: var(--yellow);
}

.brand-mark::before {
  left: 11px;
  top: 0;
  bottom: 0;
  width: 6px;
}

.brand-mark::after {
  top: 14px;
  left: 0;
  right: 0;
  height: 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text small {
  color: #bcd6ee;
  font-size: 0.75rem;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.who {
  font-size: 0.85rem;
  color: #d7e6f5;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-online {
  background: #0b7a4b;
  color: var(--white);
}

.badge-offline {
  background: var(--yellow);
  color: #4a3a00;
}

.badge-pending {
  background: #fff;
  color: var(--blue-dark);
}

.pill {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--yellow);
  color: #453600;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.phase-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 10px 20px;
  background: var(--yellow-soft);
  border-bottom: 2px solid var(--yellow);
  font-size: 0.85rem;
  color: #4a3a00;
}

.phase-bar strong {
  color: var(--blue-dark);
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px calc(48px + env(safe-area-inset-bottom));
}

.stack,
.stack-lg {
  display: flex;
  flex-direction: column;
}

.stack {
  gap: 10px;
}

.stack-lg {
  gap: 18px;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-soft);
}

.login {
  max-width: 460px;
  margin: 24px auto;
}

#login-view:has(#invite-form:not([hidden])) .login {
  max-width: 560px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}

.wizard-step {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 4px;
  border-radius: 8px;
  background: var(--blue-soft);
  text-align: center;
}

.wizard-step.is-active {
  color: var(--blue-dark);
  background: var(--yellow-soft);
}

.wizard-step.is-done {
  color: var(--ok);
}

.join-wizard fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.join-wizard legend {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.optional {
  font-weight: 500;
  color: var(--muted);
}

.field-error {
  display: block;
  margin: -4px 0 6px;
  font-size: 0.75rem;
  color: var(--danger);
}

input.is-invalid,
textarea.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.join-summary {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--blue-soft);
}

.join-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.join-summary dt,
.join-summary .label {
  color: var(--muted);
}

.join-summary strong {
  color: var(--blue-dark);
  text-align: right;
}

.join-actions {
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .form-grid,
  .wizard-steps {
    grid-template-columns: 1fr 1fr;
  }
}

.login-mode {
  margin: 16px 0 18px;
}

.invite-code-display {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.7rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--blue);
  margin: 8px 0 14px;
  word-break: break-all;
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 83, 160, 0.25);
  border-color: var(--blue);
}

input[type="file"] {
  padding: 7px;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.primary {
  background: var(--blue);
  color: var(--white);
}

button.primary:hover {
  background: var(--blue-dark);
}

button.accent {
  background: var(--yellow);
  color: #44360a;
}

button.ghost {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 7px 12px;
}

.topbar .ghost {
  color: var(--white);
}

button.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f0bdbb;
}

button.small {
  padding: 5px 9px;
  font-size: 0.8rem;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 12px 0;
}

.grid-form.wide {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border: 1px solid #c5d9ec;
  font-size: 0.85rem;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--blue-dark);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  background: var(--blue-soft);
  color: var(--blue-dark);
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 9px 10px;
  white-space: nowrap;
}

td {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

td.right,
th.right {
  text-align: right;
}

tbody tr:hover {
  background: #f7fafd;
}

td input {
  margin: 0;
  padding: 5px 7px;
  max-width: 110px;
}

/* ---------- Status ---------- */

.status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-otvorene {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.status-uzamknute {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-schvalene {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-rozporovane {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-podana {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-schvalena {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-zamietnuta {
  background: var(--danger-soft);
  color: var(--danger);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.tile {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--blue-soft);
  border-left: 4px solid var(--blue);
}

.tile.accent {
  background: var(--yellow-soft);
  border-left-color: var(--yellow);
}

.tile span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tile strong {
  display: block;
  margin-top: 3px;
  font-size: 1.15rem;
  color: var(--blue-dark);
}

/* ---------- Lists & cards ---------- */

.doc-list,
.feed {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.doc-list li,
.feed li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.feed li.unread {
  background: var(--yellow-soft);
  padding-left: 10px;
  border-left: 3px solid var(--yellow);
}

.worker-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.worker-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--white);
}

.worker-card h3 {
  margin: 0 0 6px;
}

.worker-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 8px 0;
  font-size: 0.85rem;
}

.worker-card dt {
  color: var(--muted);
}

.worker-card dd {
  margin: 0;
  font-weight: 600;
}

/* ---------- Dialog ---------- */

.dialog {
  width: min(680px, 94vw);
  border: 0;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 30, 60, 0.35);
}

.dialog::backdrop {
  background: rgba(0, 40, 80, 0.55);
}

.sign-pad {
  width: 100%;
  height: 220px;
  background: #fffdf4;
  border: 2px dashed var(--yellow);
  border-radius: 10px;
  touch-action: none;
  cursor: crosshair;
}

.audit-note {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--blue-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

/* ---------- Misc ---------- */

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--blue-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: 92vw;
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--blue-dark);
  color: var(--white);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}

.toast.error {
  background: var(--danger);
  color: var(--white);
}

.toast.ok {
  background: var(--ok);
}

.empty {
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.status-vyplatena {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.pill-alert {
  background: var(--danger);
  color: #fff;
}

.bulk-actions {
  align-items: center;
  margin: 12px 0;
}

.sign-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.sign-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.sign-list li:last-child {
  border-bottom: 0;
}


/* ---------- Chat (Messenger / WhatsApp štýl) ---------- */

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 12px;
  padding: 3px;
  background: #e9eff6;
  border-radius: 12px;
}

.segmented-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 2);
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 40, 80, 0.15);
  transform: translateX(calc(var(--tab-index, 0) * 100%));
  transition: transform 0.42s var(--ease-ios);
}

.segmented button {
  position: relative;
  z-index: 1;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  transition: color 0.25s ease, transform 0.15s var(--ease-ios);
}

.segmented button.active {
  color: var(--blue-dark);
}

.chat {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.chat-threads {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.thread {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.15s var(--ease-ios);
}

.thread.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.thread-name {
  font-weight: 700;
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.chat-title {
  margin: 0;
  font-weight: 700;
  color: var(--blue-dark);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  background: #eaf0f7;
  border-radius: 16px;
}

.day-sep {
  align-self: center;
  margin: 8px 0 4px;
  padding: 2px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.msg {
  max-width: 82%;
  margin-top: 4px;
  padding: 7px 12px 5px;
  border-radius: 18px;
  box-shadow: 0 1px 1px rgba(0, 40, 80, 0.12);
  transition: opacity 0.3s ease, transform 0.35s var(--ease-ios);
}

.msg.theirs {
  align-self: flex-start;
  background: var(--white);
  border-bottom-left-radius: 6px;
  transform-origin: 0 100%;
}

.msg.mine {
  align-self: flex-end;
  background: var(--blue);
  color: var(--white);
  border-bottom-right-radius: 6px;
  transform-origin: 100% 100%;
}

.msg-name {
  margin-bottom: 1px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 700;
}

.msg-name span {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 500;
}

.msg-about {
  display: inline-block;
  margin: 2px 0;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--yellow);
  color: #453600;
  font-size: 0.7rem;
  font-weight: 700;
}

.msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  font-size: 0.66rem;
  opacity: 0.7;
}

.msg.sending {
  opacity: 0.7;
}

.msg.sending .msg-state {
  animation: dot-pulse 1s ease-in-out infinite;
}

.msg.delivered .msg-state {
  animation: tick-pop 0.4s var(--ease-ios);
}

.msg.failed {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
}

.enter-mine {
  animation: msg-in-mine 0.42s var(--ease-ios) backwards;
}

.enter-theirs {
  animation: msg-in-theirs 0.42s var(--ease-ios) backwards;
}

.chat-form {
  display: grid;
  gap: 8px;
}

.chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-compose textarea {
  flex: 1;
  margin: 0;
  max-height: 120px;
  padding: 10px 14px;
  border-radius: 20px;
  resize: none;
  line-height: 1.35;
}

button.send {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: 1.05rem;
}

/* ---------- Spodná lišta (mobil) ---------- */

.tabbar {
  display: none;
}

/* ---------- Animácie a prechody ---------- */

:root {
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes fade-out {
  to { opacity: 0; }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
}

@keyframes panel-out {
  to { opacity: 0; transform: translateY(14px) scale(0.985); }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
}

@keyframes sheet-down {
  to { transform: translateY(100%); }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
}

@keyframes dialog-out {
  to { opacity: 0; transform: translateY(16px) scale(0.97); }
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(14px); }
}

@keyframes msg-in-mine {
  from { opacity: 0; transform: translate(14px, 18px) scale(0.9); }
}

@keyframes msg-in-theirs {
  from { opacity: 0; transform: translate(-14px, 18px) scale(0.9); }
}

@keyframes tick-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes dot-pulse {
  50% { opacity: 0.25; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 24px) scale(0.96); }
}

@keyframes slide-from-right {
  from { opacity: 0; transform: translateX(28px); }
}

@keyframes slide-from-left {
  from { opacity: 0; transform: translateX(-28px); }
}

.slide-from-right {
  animation: slide-from-right 0.38s var(--ease-ios);
}

.slide-from-left {
  animation: slide-from-left 0.38s var(--ease-ios);
}

/* Karty sa pri zobrazení panelu / pohľadu jemne vysunú (pri každom zobrazení, nie pri obnove dát). */
#notifications-view,
#chat-view {
  animation: panel-in 0.4s var(--ease-ios) backwards;
}

#notifications-view.closing,
#chat-view.closing {
  animation: panel-out 0.26s var(--ease-ios) forwards;
}

#login-view,
#worker-view,
#supervisor-view,
#client-view,
#owner-view {
  animation: view-in 0.5s var(--ease-out) backwards;
}

.stack-lg > .card {
  animation: view-in 0.55s var(--ease-out) backwards;
}

.stack-lg > .card:nth-child(2) { animation-delay: 70ms; }
.stack-lg > .card:nth-child(3) { animation-delay: 140ms; }
.stack-lg > .card:nth-child(4) { animation-delay: 210ms; }
.stack-lg > .card:nth-child(n + 5) { animation-delay: 280ms; }

.toast {
  animation: toast-in 0.4s var(--ease-ios);
}

.dialog[open] {
  animation: dialog-in 0.36s var(--ease-ios);
}

.dialog[open]::backdrop {
  animation: fade-in 0.3s ease;
}

.dialog.closing {
  animation: dialog-out 0.26s var(--ease-ios) forwards;
}

.dialog.closing::backdrop {
  animation: fade-out 0.26s ease forwards;
}

button {
  transition: transform 0.18s var(--ease-ios), background-color 0.25s ease, opacity 0.25s ease;
}

button:active:not(:disabled) {
  transform: scale(0.95);
}

.chip,
.tile,
.feed li {
  transition: background-color 0.25s ease, transform 0.18s var(--ease-ios);
}

.pill {
  transition: background-color 0.25s ease, transform 0.3s var(--ease-ios);
}

/* ---------- Mobil: spodné panely a lišta ---------- */

@media (max-width: 720px) {
  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .tabbar-thumb {
    position: absolute;
    top: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    left: 0;
    width: calc(100% / 3);
    padding: 0 10px;
    transform: translateX(calc(var(--tab-index, 0) * 100%));
    transition: transform 0.45s var(--ease-ios);
  }

  .tabbar-thumb::before {
    content: "";
    display: block;
    height: 100%;
    border-radius: 12px;
    background: var(--blue-soft);
  }

  .tabbar button {
    position: relative;
    z-index: 1;
    padding: 12px 6px;
    background: transparent;
    color: var(--muted);
    transition: color 0.25s ease, transform 0.18s var(--ease-ios);
  }

  .tabbar button.active {
    color: var(--blue-dark);
  }

  body.has-tabbar .layout {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  /* Oznámenia a chat sa otvárajú ako spodný panel nad lištou. */
  #notifications-view,
  #chat-view {
    position: fixed;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 40;
    margin: 0;
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 30, 60, 0.28);
    animation-name: sheet-up;
    animation-duration: 0.45s;
  }

  #notifications-view.closing,
  #chat-view.closing {
    animation-name: sheet-down;
    animation-duration: 0.3s;
  }

  #notifications-view::before,
  #chat-view::before {
    content: "";
    display: block;
    width: 38px;
    height: 4px;
    margin: -6px auto 10px;
    border-radius: 4px;
    background: var(--line);
  }

  #chat-view {
    display: flex;
    flex-direction: column;
    height: min(78dvh, 640px);
    overflow: hidden;
  }

  #chat-view .chat,
  #chat-view .chat-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  #chat-view .chat-messages {
    flex: 1;
    height: auto;
    min-height: 0;
  }

  .chat-compose textarea {
    font-size: 16px; /* iOS nezväčšuje pole pri fokuse */
  }

  /* Dialógy ako spodné panely. */
  .dialog {
    width: 100%;
    max-width: none;
    max-height: 94dvh;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .dialog[open] {
    animation: sheet-up 0.42s var(--ease-ios);
  }

  .dialog.closing {
    animation: sheet-down 0.3s var(--ease-ios) forwards;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 14px;
  }

  .topbar {
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 720px) {
  /* Oznámenia a chat sú na mobile v spodnej lište. */
  .topbar #btn-bell,
  .topbar #btn-chat {
    display: none;
  }
}

.row-missed td {
  background: var(--danger-soft);
}

.row-warn td {
  background: var(--warn-soft);
}

.warn {
  color: var(--danger);
  font-weight: 600;
}

.lang-switch {
  display: flex;
  gap: 4px;
}

.topbar .lang-switch button {
  min-width: 36px;
  border-color: rgba(255, 255, 255, 0.4);
}

.topbar .lang-switch button.active {
  background: var(--yellow);
  color: var(--blue-dark);
  border-color: var(--yellow);
  font-weight: 700;
}

.chat-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-soft);
  cursor: pointer;
}

.msg-photo {
  display: block;
  max-width: min(240px, 70vw);
  border-radius: 12px;
  margin: 4px 0;
}

.ios-steps {
  padding-left: 18px;
  line-height: 1.5;
}

.ios-share {
  display: inline-block;
  margin-left: 4px;
  font-size: 1.2rem;
}

#btn-export-csv {
  display: inline-flex;
  text-decoration: none;
}
