:root {
  --nz-bg: #f6f5f2;
  --nz-surface: #ffffff;
  --nz-text: #1c1917;
  --nz-muted: #78716c;
  --nz-border: #e7e5e4;
  --nz-primary: #4338ca;
  --nz-primary-hover: #3730a3;
  --nz-danger: #dc2626;
  --nz-ok: #16a34a;
  --nz-radius: 12px;
  --nz-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.08);
  --nz-bar-h: 56px;
  --nz-chat-w: 320px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--nz-text);
  background: var(--nz-bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.nz-muted {
  color: var(--nz-muted);
}

.nz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.nz-btn-primary {
  background: var(--nz-primary);
  color: #fff;
}

.nz-btn-primary:hover {
  background: var(--nz-primary-hover);
}

.nz-btn-ghost {
  border-color: var(--nz-border);
  background: var(--nz-surface);
}

.nz-btn-ghost:hover {
  background: #f5f5f4;
}

.nz-btn:focus-visible,
.nz-icon-btn:focus-visible {
  outline: 2px solid var(--nz-primary);
  outline-offset: 2px;
}

.nz-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

.nz-icon-btn:hover {
  background: #f5f5f4;
}

.nz-alerts {
  position: relative;
  font-size: 17px;
}

.nz-alerts-ask::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nz-danger);
}

/* Pasek pokoju */

.nz-bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nz-bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--nz-border);
  z-index: 50;
}

.nz-home {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 8px;
}

.nz-home:hover {
  background: #f5f5f4;
}

.nz-home img {
  width: 26px;
  height: 26px;
}

.nz-title {
  min-width: 80px;
  width: 260px;
  max-width: 30vw;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-weight: 600;
  text-overflow: ellipsis;
}

.nz-title:hover:not([readonly]),
.nz-title:focus {
  border-color: var(--nz-border);
  background: var(--nz-surface);
  outline: none;
}

.nz-me-btn {
  position: relative;
}

.nz-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #a8a29e;
}

.nz-offline {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  white-space: nowrap;
}

.nz-offline[hidden] {
  display: none;
}

.nz-offline[data-status="fatal"] {
  background: #fee2e2;
  color: #991b1b;
}

.nz-status[data-status="online"] {
  background: var(--nz-ok);
}

.nz-status[data-status="reconnecting"] {
  background: #f59e0b;
  animation: nz-pulse 1s infinite;
}

.nz-status[data-status="fatal"] {
  background: var(--nz-danger);
}

@keyframes nz-pulse {
  50% {
    opacity: 0.3;
  }
}

.nz-bar-spacer {
  flex: 1;
}

.nz-people {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.nz-people .nz-avatar {
  margin-left: -8px;
  border: 2px solid #fff;
}

.nz-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  user-select: none;
}

.nz-avatar:not(.nz-more) {
  font-size: 18px;
  line-height: 1;
}

.nz-avatar-lg {
  width: 52px;
  height: 52px;
}

.nz-avatar-lg:not(.nz-more) {
  font-size: 28px;
}

.nz-more {
  background: #78716c;
}

.nz-me-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}

.nz-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--nz-danger);
  color: #fff;
  font-size: 11px;
  display: inline-grid;
  place-items: center;
}

.nz-badge[hidden] {
  display: none;
}

/* Dialogi */

.nz-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--nz-shadow);
}

.nz-dialog::backdrop {
  background: rgb(28 25 23 / 0.35);
}

.nz-dialog form {
  padding: 22px 24px;
  display: grid;
  gap: 14px;
}

.nz-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.nz-dialog p {
  margin: 0;
}

.nz-dialog label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.nz-dialog input[type="text"] {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--nz-border);
  width: 100%;
  min-width: 0;
}

.nz-dialog input[type="text"]:focus {
  outline: 2px solid var(--nz-primary);
  border-color: transparent;
}

.nz-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.nz-profile {
  display: grid;
  gap: 14px;
}

.nz-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.nz-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nz-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--nz-border);
  cursor: pointer;
}

.nz-profile-name {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.nz-profile-name label {
  flex: 1;
}

.nz-emojis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 2px;
  max-height: 228px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.nz-emoji {
  height: 36px;
  border: none;
  border-radius: 8px;
  background: none;
  font-size: 22px;
  cursor: pointer;
}

.nz-emoji:hover {
  background: #f5f5f4;
}

.nz-emoji[aria-checked="true"] {
  background: #e0e7ff;
  box-shadow: inset 0 0 0 2px var(--nz-primary);
}

.nz-chat-emoji {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  color: #fff;
}

.nz-swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--nz-text);
}

.nz-invite {
  display: grid;
  gap: 16px;
}

.nz-invite-input {
  display: flex;
  gap: 6px;
}

.nz-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--nz-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nz-links {
  margin: 0;
}

.nz-why {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed var(--nz-border);
  color: var(--nz-muted);
}

.nz-why[hidden] {
  display: none;
}

.nz-check.nz-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.nz-dialog input[type="password"] {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--nz-border);
  width: 100%;
}

.nz-small {
  font-size: 13px;
  font-weight: 400;
}

.nz-lifecycle {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fafaf9;
  border: 1px solid var(--nz-border);
}

.nz-check {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.nz-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--nz-primary);
  flex: none;
}

.nz-check > span {
  display: grid;
  gap: 2px;
}

.nz-mail input,
.nz-dialog input[type="email"] {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--nz-border);
  width: 100%;
  font-weight: 400;
}

.nz-mail[hidden] {
  display: none !important;
}

.nz-settings {
  position: relative;
  font-size: 17px;
}

.nz-settings-keep::after {
  content: "📌";
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 10px;
}

.nz-organizer {
  border-top: 1px solid var(--nz-border);
  padding-top: 12px;
}

.nz-organizer summary {
  cursor: pointer;
  font-weight: 600;
}

.nz-organizer[open] {
  display: grid;
  gap: 8px;
}

.nz-warn {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef3c7;
  color: #78350f;
}

/* Czat */

.nz-chat {
  position: fixed;
  top: calc(var(--nz-bar-h) + 8px);
  right: 8px;
  bottom: 8px;
  width: min(var(--nz-chat-w), calc(100vw - 16px));
  display: flex;
  flex-direction: column;
  background: var(--nz-surface);
  border: 1px solid var(--nz-border);
  border-radius: var(--nz-radius);
  box-shadow: var(--nz-shadow);
  z-index: 40;
}

.nz-chat[hidden] {
  display: none;
}

.nz-chat header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--nz-border);
}

.nz-chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nz-chat-empty {
  text-align: center;
  margin: auto 0;
}

.nz-chat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--nz-muted);
}

.nz-chat-meta strong {
  color: var(--nz-text);
}

.nz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.nz-chat-text {
  margin-top: 2px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f5f5f4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: fit-content;
  max-width: 100%;
}

.nz-me .nz-chat-text {
  background: #e0e7ff;
}

.nz-chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--nz-border);
  align-items: flex-end;
}

.nz-chat-form textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--nz-border);
  field-sizing: content;
}

/* Powiadomienia */

.nz-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.nz-toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--nz-text);
  color: #fff;
  box-shadow: var(--nz-shadow);
  font-size: 14px;
  transition: opacity 0.4s, transform 0.4s;
}

.nz-toast-error {
  background: var(--nz-danger);
}

.nz-toast.nz-out {
  opacity: 0;
  transform: translateY(8px);
}

@media (max-width: 720px) {
  .nz-bar {
    gap: 6px;
    padding: 0 8px;
  }

  .nz-home span,
  .nz-people {
    display: none;
  }

  .nz-title {
    width: auto;
    flex: 1;
    max-width: none;
  }

  .nz-bar-spacer {
    display: none;
  }

  .nz-btn {
    padding: 0 10px;
  }
}
