﻿:root {
  --paper: #eef4f8;
  --paper-2: #e2edf4;
  --surface: #ffffff;
  --white: #ffffff;
  --ink: #0f2430;
  --muted: #5b7383;
  --line: #d5e3ec;
  --line-strong: #b9cdd9;

  --blue: #006aa7;
  --blue-dark: #004b78;
  --blue-soft: #e6f1f8;
  --flag-blue: #006aa7;
  --flag-yellow: #fecc00;
  --yellow: #fecc00;
  --yellow-soft: #fff6cc;

  --ok: #2f6b4d;
  --ok-soft: #e6efe9;
  --warn: #8a6220;
  --warn-soft: #f7eeda;
  --danger: #a33a32;
  --danger-soft: #f6e8e6;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 1px 2px rgba(0, 75, 120, 0.05);
  --shadow: 0 8px 24px rgba(0, 75, 120, 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(--paper);
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  min-height: 100dvh;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.atmosphere-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(0, 106, 167, 0.16), transparent 55%),
    radial-gradient(640px 280px at 100% 0%, rgba(254, 204, 0, 0.18), transparent 46%),
    linear-gradient(180deg, #dceaf3 0%, var(--paper) 46%, #e8f1f6 100%);
}

.atmosphere-ridge,
.atmosphere-grain {
  display: none;
}

.phase-bar,
.layout {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--blue-dark);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.12rem;
}

h3 {
  font-size: 0.98rem;
  margin-top: 22px;
}

p {
  margin: 6px 0;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 22px 10px;
  background: var(--flag-blue);
  color: var(--white);
  border-bottom: 4px solid var(--flag-yellow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--flag-blue);
  overflow: hidden;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: var(--flag-yellow);
}

.brand-mark::before {
  left: 10px;
  top: 0;
  bottom: 0;
  width: 6px;
}

.brand-mark::after {
  top: 13px;
  left: 0;
  right: 0;
  height: 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.who {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.82);
}

.badge {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-online {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-offline {
  background: var(--yellow-soft);
  color: var(--warn);
}

.badge-pending {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.pill {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--yellow);
  color: #3f3109;
  font-size: 0.73rem;
  font-weight: 700;
  text-align: center;
}

.phase-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 10px 24px;
  background: var(--blue-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--blue-dark);
}

.phase-bar strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px calc(72px + env(safe-area-inset-bottom));
}

.stack,
.stack-lg {
  display: flex;
  flex-direction: column;
}

.stack {
  gap: 12px;
}

.stack-lg {
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 28px 26px;
  margin-bottom: 22px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  position: relative;
  padding-left: 14px;
}

/* Jemný zvislý pruh v odtieni vlajky – nordický akcent bez krikľavosti. */
.card-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.12em;
  bottom: 0.12em;
  width: 3px;
  border-radius: 2px;
  background: var(--flag-blue);
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}

.consent span {
  flex: 1 1 auto;
  min-width: 0;
}

.consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  flex: 0 0 18px;
  accent-color: var(--blue);
}

.consent.is-invalid,
.consent.is-invalid span {
  color: var(--danger);
}

.consent input[type="checkbox"].is-invalid {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.gdpr-policy-dialog {
  width: min(760px, 96vw);
  max-height: 88vh;
}

.gdpr-article {
  max-height: 58vh;
  overflow: auto;
  padding-right: 6px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink, #1b2733);
}

.gdpr-article h3 {
  margin: 16px 0 6px;
  font-size: 0.95rem;
}

.gdpr-article p {
  margin: 0 0 8px;
}

.layout:has(#login-view:not([hidden])) {
  max-width: none;
  padding: 0;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 62px);
  padding: 40px 16px 48px;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 62%),
    linear-gradient(
      var(--flag-blue) 0 31%,
      var(--flag-yellow) 31% 32.1%,
      #eef4f8 32.1%
    );
}

.login-card {
  width: min(430px, 100%);
  padding: 32px 30px 28px;
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(0, 50, 90, 0.18);
}

.login-rule {
  display: block;
  width: 42px;
  height: 2px;
  margin: 14px 0 10px;
  background: linear-gradient(90deg, var(--flag-yellow), var(--flag-blue));
  border-radius: 2px;
}

.login-langs {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin: -4px 0 16px;
}

.login-langs button.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

.login-screen:has(#invite-form:not([hidden])) .login-card {
  width: min(520px, 100%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sweden-flag {
  position: relative;
  width: 28px;
  height: 18px;
  border-radius: 3px;
  background: var(--flag-blue);
  overflow: hidden;
  flex: 0 0 auto;
}

.sweden-flag::before,
.sweden-flag::after {
  content: "";
  position: absolute;
  background: var(--flag-yellow);
}

.sweden-flag::before {
  left: 8px;
  top: 0;
  bottom: 0;
  width: 5px;
}

.sweden-flag::after {
  top: 6px;
  left: 0;
  right: 0;
  height: 5px;
}

.login-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--blue-dark);
}

.login-lead {
  margin: 8px 0 4px;
  font-size: 0.93rem;
}

.login-public-link {
  margin: 16px 0 0;
  text-align: center;
}

.login-public-link a {
  color: var(--blue);
  font-size: 0.9rem;
}

#login-form .primary {
  width: 100%;
  margin-top: 4px;
  padding: 12px 16px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}

.wizard-step {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 4px 7px;
  border-top: 2px solid var(--line);
  text-align: center;
}

.wizard-step.is-active {
  color: var(--ink);
  border-top-color: var(--flag-blue);
}

.wizard-step.is-done {
  color: var(--ok);
  border-top-color: var(--ok);
}

.join-wizard fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.join-wizard legend {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.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: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.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(--ink);
  font-weight: 600;
  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-card {
  background: linear-gradient(180deg, var(--blue-soft), var(--surface) 48%);
}

.invite-code-display {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.65rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--blue-dark);
  margin: 4px 0 16px;
  padding: 16px 18px;
  word-break: break-all;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--flag-blue);
  box-shadow: 0 0 0 3px rgba(0, 106, 167, 0.14);
}

input[type="file"] {
  padding: 7px;
}

button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
}

button.primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 8px 18px rgba(0, 89, 143, 0.18);
}

button.primary:hover {
  background: var(--blue-dark);
}

button.accent {
  background: var(--yellow);
  color: #3f3109;
}

button.accent:hover {
  background: var(--flag-yellow);
}

button.ghost {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 8px 13px;
}

button.ghost:hover {
  background: var(--paper);
  border-color: var(--muted);
}

.topbar .ghost {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.topbar .ghost:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
}

.icon-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#btn-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.burger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 12px;
}

.burger i {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.app-menu {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.app-menu-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 32, 48, 0.38);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.app-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: var(--white);
  color: var(--ink);
  border-left: 1px solid var(--line);
}

.app-menu-who {
  padding: 4px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.app-menu-who strong {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-menu-who small {
  color: var(--muted);
}

.app-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 13px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.app-menu-item:hover,
.app-menu-item:focus {
  background: var(--paper);
}

.app-menu-item.danger-text {
  margin-top: auto;
  color: var(--danger);
}

.settings-langs {
  display: flex;
  gap: 8px;
}

.settings-langs button {
  min-width: 48px;
}

.settings-langs button.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

button.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #e8c9c5;
}

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(--paper);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: var(--blue-soft);
  color: var(--blue-dark);
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 14px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  background: transparent;
}

tbody tr:nth-child(even) td {
  background: #f7fafc;
}

td.right,
th.right {
  text-align: right;
}

tbody tr:hover td {
  background: var(--paper);
}

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: 16px 16px 14px;
  border-radius: var(--radius);
  background: var(--blue-soft);
  border: 1px solid #cfe0eb;
  border-left: 4px solid var(--flag-blue);
}

.tile.accent {
  background: var(--yellow-soft);
  border-color: #eadfc2;
  border-left-color: var(--flag-yellow);
}

.tile span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tile strong {
  display: block;
  margin-top: 5px;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  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: 12px;
  border-left: 3px solid var(--flag-yellow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.worker-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.worker-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  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: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 28px;
  box-shadow: 0 30px 70px rgba(10, 32, 48, 0.28);
}

.dialog::backdrop {
  background: rgba(10, 32, 48, 0.42);
}

.sign-pad {
  width: 100%;
  height: 220px;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  touch-action: none;
  cursor: crosshair;
}

.audit-note {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

/* ---------- Misc ---------- */

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--flag-yellow);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: 92vw;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 12px 32px rgba(10, 32, 48, 0.28);
  font-size: 0.88rem;
}

.toast.error {
  background: var(--danger);
  color: var(--white);
}

.toast.ok {
  background: var(--ok);
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.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: 14px;
  padding: 4px;
  background: var(--paper-2);
  border-radius: var(--radius);
}

.segmented-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(10, 32, 48, 0.12);
  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(--ink);
}

.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: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  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(--flag-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: 600;
  color: var(--ink);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.day-sep {
  align-self: center;
  margin: 8px 0 4px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.msg {
  max-width: 82%;
  margin-top: 4px;
  padding: 8px 13px 6px;
  border-radius: 16px;
  box-shadow: 0 1px 1px rgba(10, 32, 48, 0.08);
  transition: opacity 0.3s ease, transform 0.35s var(--ease-ios);
}

.msg.theirs {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  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: 1px 9px;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: var(--warn);
  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,
#account-view,
#app-settings-view {
  animation: panel-in 0.4s var(--ease-ios) backwards;
}

#notifications-view.closing,
#chat-view.closing,
#account-view.closing,
#app-settings-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,
  #account-view,
  #app-settings-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,
  #account-view.closing,
  #app-settings-view.closing {
    animation-name: sheet-down;
    animation-duration: 0.3s;
  }

  #notifications-view::before,
  #chat-view::before,
  #account-view::before,
  #app-settings-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 {
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-mark::before {
    left: 9px;
    width: 5px;
  }

  .brand-mark::after {
    top: 11px;
    height: 5px;
  }

  .brand-text small,
  .topbar .who,
  .topbar #net-badge {
    display: none;
  }

  .topbar .ghost,
  .topbar .ghost.small {
    min-height: 36px;
    padding: 6px 10px;
  }

  .project-switch {
    order: 3;
    width: 100%;
  }

  .topbar-tools {
    margin-left: auto;
    gap: 6px;
  }
}

@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;
  }
}

tbody tr.row-missed td,
tbody tr.row-missed:hover td {
  background: var(--danger-soft);
}

tbody tr.row-warn td,
tbody tr.row-warn:hover td {
  background: var(--warn-soft);
}

.warn {
  color: var(--danger);
  font-weight: 600;
}

.lang-switch {
  display: flex;
  gap: 4px;
}

.topbar .lang-switch button,
.topbar .project-switch button {
  min-width: 36px;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.topbar .lang-switch button.active,
.topbar .project-switch button.active {
  background: var(--flag-yellow);
  color: var(--blue-dark);
  border-color: var(--flag-yellow);
  font-weight: 700;
}

.project-switch {
  display: flex;
  gap: 4px;
}

.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;
}
