/* ============================================================
   LubaNote – S2A Sharing Identity
============================================================ */

.sharingIdentitySetting {
  min-height: 58px;
}

.sharingUsernameButton {
  max-width: min(230px, 56vw);
}

#sharingUsernameValue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sharingUsernameValue:not(.sharingUsernameUnset) {
  font-weight: 800;
}

.sharingUsernameUnset {
  color: var(--color-text-secondary);
}

.sharingIdentityModal {
  position: fixed;
  inset: 0;
  z-index: 5200;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 18px;
  box-sizing: border-box;

  background: rgba(0, 0, 0, 0.48);
}

.sharingIdentityModal[hidden] {
  display: none !important;
}

.sharingIdentityCard {
  width: min(100%, 440px);
  box-sizing: border-box;

  padding: 18px;

  border: 1px solid var(--color-border);
  border-radius: 18px;

  background: var(--color-surface);
  color: var(--color-text);

  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
}

.sharingIdentityHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  margin-bottom: 8px;
}

.sharingIdentityHeader h3 {
  margin: 0;
  font-size: calc(1rem + 0.1875rem);
}

.sharingIdentityClose {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;

  border: none;
  border-radius: 12px;

  background: transparent;
  color: var(--color-text);
}

.sharingIdentityDescription {
  margin: 0 0 16px;

  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.125rem);
  line-height: 1.45;
}

.sharingIdentityField {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;

  min-height: 52px;
  box-sizing: border-box;

  padding: 0 12px;

  border: 1px solid var(--color-border);
  border-radius: 14px;

  background: var(--color-background);
}

.sharingIdentityPrefix {
  color: var(--color-text-secondary);
  font-size: calc(1rem + 0.125rem);
  font-weight: 800;
}

.sharingIdentityField input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;

  padding: 12px 8px;

  border: none;
  outline: none;

  background: transparent;
  color: var(--color-text);

  font: inherit;
  font-weight: 700;
}

.sharingIdentityError {
  min-height: 20px;
  margin: 8px 2px 0;

  color: #d44;
  font-size: calc(1rem - 0.125rem);
  line-height: 1.35;
}

.sharingIdentityError[hidden] {
  display: none;
}

.sharingIdentityActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;

  margin-top: 18px;
}

.sharingIdentityActions button {
  min-height: 46px;

  border: 1px solid var(--color-border);
  border-radius: 13px;

  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.sharingIdentitySecondary {
  background: var(--color-background);
  color: var(--color-text);
}

.sharingIdentityPrimary {
  background: var(--color-accent);
  color: #ffffff;
}

.sharingIdentityActions button:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 520px) {
  .sharingIdentityModal {
    align-items: flex-end;
    padding: 10px;
  }

  .sharingIdentityCard {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
  }
}

/* ============================================================
   S2B – Share modal + invitations
============================================================ */

.sharingInvitationsButton {
  position: relative;
}

.sharingInvitationsIcon {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sharingInvitationsBadge {
  position: absolute;
  top: -5px;
  right: -6px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 18px;
  height: 18px;
  box-sizing: border-box;
  padding: 0 5px;

  border: 2px solid var(--color-background);
  border-radius: 999px;

  background: #d84c57;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 900;
  line-height: 1;
}

.sharingInvitationsBadge[hidden] {
  display: none !important;
}

.sharingInvitationsButton.hasInvitations {
  color: var(--color-accent);
}

.modalTitleRow .sharingNoteButton {
  flex: 0 0 auto;

  width: auto;
  min-width: 58px;
  height: 38px;
  box-sizing: border-box;
  padding: 0 11px;

  border: 1px solid var(--color-border);
  border-radius: 12px;

  background: var(--color-background);
  color: var(--color-editor-text);

  font: inherit;
  font-size: calc(1rem - 0.125rem);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.modalTitleRow .sharingNoteButton:active {
  transform: scale(0.96);
}

.modalTitleRow .sharingNoteButton[hidden] {
  display: none !important;
}

.sharingModal {
  position: fixed;
  inset: 0;
  z-index: 5250;

  display: flex;
  align-items: center;
  justify-content: center;

  box-sizing: border-box;
  padding: 18px;

  background: rgba(0, 0, 0, 0.5);
}

.sharingModal[hidden] {
  display: none !important;
}

.sharingModalCard {
  width: min(100%, 520px);
  max-height: min(82vh, 720px);
  box-sizing: border-box;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;

  border: 1px solid var(--color-border);
  border-radius: 18px;

  background: var(--color-surface);
  color: var(--color-text);

  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}

.sharingModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin-bottom: 8px;
}

.sharingModalHeader h3 {
  margin: 0;
  font-size: calc(1rem + 0.1875rem);
}

.sharingModalClose {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;

  border: none;
  border-radius: 12px;

  background: transparent;
  color: var(--color-text);

  font: inherit;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.sharingNoteName {
  margin: 2px 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: var(--color-text);
  font-weight: 850;
}

.sharingModalDescription {
  margin: 0 0 14px;
  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.125rem);
  line-height: 1.45;
}

.sharingInviteForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: stretch;
}

.sharingInviteField {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;

  min-width: 0;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 10px;

  border: 1px solid var(--color-border);
  border-radius: 13px;
  background: var(--color-background);
}

.sharingInvitePrefix {
  color: var(--color-text-secondary);
  font-weight: 850;
}

.sharingInviteField input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 7px;

  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);

  font: inherit;
  font-weight: 700;
}

.sharingPrimaryButton,
.sharingSecondaryButton,
.sharingSmallButton {
  border: 1px solid var(--color-border);
  border-radius: 12px;

  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.sharingPrimaryButton {
  min-height: 44px;
  padding: 0 14px;

  background: var(--color-accent);
  color: #fff;
}

.sharingSecondaryButton,
.sharingSmallButton {
  background: var(--color-background);
  color: var(--color-text);
}

.sharingSecondaryButton {
  min-height: 44px;
  padding: 0 13px;
}

.sharingSmallButton {
  min-height: 34px;
  padding: 0 10px;
  font-size: calc(1rem - 0.125rem);
}

.sharingPrimaryButton:disabled,
.sharingSecondaryButton:disabled,
.sharingSmallButton:disabled {
  opacity: 0.55;
  cursor: default;
}

.sharingModalStatus {
  min-height: 20px;
  margin: 8px 2px 0;

  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.125rem);
  line-height: 1.35;
}

.sharingModalStatus[hidden] {
  display: none !important;
}

.sharingModalStatus[data-typ="error"] {
  color: #d44;
}

.sharingModalStatus[data-typ="success"] {
  color: var(--color-accent);
  font-weight: 700;
}

.sharingListSection {
  margin-top: 18px;
}

.sharingListSection h4 {
  margin: 0 0 8px;
  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.125rem);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sharingPeopleList,
.sharingInvitationsList {
  display: grid;
  gap: 8px;
}

.sharingPersonRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  min-height: 48px;
  box-sizing: border-box;
  padding: 8px 10px;

  border: 1px solid var(--color-border);
  border-radius: 13px;
  background: var(--color-background);
}

.sharingPersonInfo {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sharingPersonInfo strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sharingPersonInfo span {
  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.1875rem);
}

.sharingPersonActions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.sharingDangerButton {
  border-color: rgba(255, 90, 103, 0.58);
  color: #ff8b94;
}

@media (max-width: 520px) {
  .sharingPersonRow {
    align-items: flex-start;
  }

  .sharingPersonActions {
    max-width: 54%;
  }
}

.sharingEmptyState {
  margin: 0;
  padding: 12px;

  border: 1px dashed var(--color-border);
  border-radius: 12px;

  color: var(--color-text-secondary);
  text-align: center;
  font-size: calc(1rem - 0.125rem);
}

.sharingIncomingToolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.sharingInvitationCard {
  display: grid;
  gap: 5px;

  box-sizing: border-box;
  padding: 12px;

  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-background);
}

.sharingInvitationTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sharingInvitationInviter {
  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.125rem);
}

.sharingInvitationActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 7px;
}

@media (max-width: 520px) {
  .sharingModal {
    /*
     * Android edge-to-edge může mít systémovou navigaci uvnitř
     * layout viewportu. Stejně jako fullscreen editor se proto
     * řídíme skutečným visualViewport z script.js a necháváme
     * pevnou bezpečnou rezervu pod kartou.
     */
    inset: auto 0 auto 0;
    top: var(--visual-top, 0px);
    width: 100%;
    height: var(--visual-height, 100dvh);
    min-height: 0;

    align-items: center;
    padding:
      max(10px, env(safe-area-inset-top))
      10px
      max(58px, env(safe-area-inset-bottom));
  }

  .sharingModalCard {
    width: 100%;
    max-height: calc(var(--visual-height, 100dvh) - 82px);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
  }

  .sharingInviteForm {
    grid-template-columns: 1fr;
  }

  .sharingInviteForm .sharingPrimaryButton {
    width: 100%;
  }
}


/* ============================================================
   S2C – SHARED NOTE CARDS + READ-ONLY VIEWER
============================================================ */

.sharingSharedCard {
  position: relative;
  cursor: pointer;

  /* PATCH 467 – starý Android/WebView kreslí na kliknutelném DIVu vlastní
     modrý tap-highlight přes kartu. Shared karta má vlastní 1x/2x tap UX,
     takže nativní highlight je jen rušivý a není součást LubaNote UI. */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.sharingSharedCard * {
  -webkit-tap-highlight-color: transparent;
}

.sharingSharedCard::after {
  content: "";
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--color-accent) 42%, transparent);
  border-radius: 17px;
}

.sharingSharedCardIcon {
  display: inline-block;
  margin-right: 7px;
  font-size: 0.9em;
  vertical-align: 0.05em;
}

.taskCard .sharingSharedCardMeta {
  margin: 7px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  color: var(--color-accent) !important;
  font-size: calc(1rem - 0.25rem) !important;
  font-weight: 750;
  line-height: 1.25;
}

.sharingReadOnlyViewer {
  position: fixed;
  inset: 0;
  z-index: 5240;

  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;

  background: var(--color-editor-background);
  color: var(--color-editor-text);
}

.sharingReadOnlyViewer[hidden] {
  display: none !important;
}

body.sharingReadOnlyOpen {
  overflow: hidden;
}

.sharingReadOnlyHeader {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;

  box-sizing: border-box;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-editor-background);
}

.sharingReadOnlyClose {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;

  border: 1px solid var(--color-border);
  border-radius: 13px;

  background: var(--color-background);
  color: var(--color-editor-text);
  font: inherit;
  font-size: 1.8125rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}


.sharingReadOnlyEdit {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 15px;

  border: 1px solid color-mix(
    in srgb,
    var(--color-accent) 72%,
    var(--color-border)
  );
  border-radius: 13px;

  background: color-mix(
    in srgb,
    var(--color-accent) 18%,
    var(--color-background)
  );
  color: var(--color-editor-text);
  font: inherit;
  font-size: calc(1rem - 0.125rem);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.sharingReadOnlyEdit:disabled {
  opacity: 0.55;
  cursor: wait;
}

/*
 * S2E – obrázky jsou už součást společného editovatelného obsahu.
 * Otevření libovolného dokumentu zůstává mimo shared V1, ale
 * vložení obrázku + jeho velikost/zarovnání/odebrání používá stejné
 * editorMedia UI jako běžná poznámka.
 */
#taskModal.sharingEditorMode #tlacitkoOtevritDokument {
  display: none !important;
}

#taskModal.sharingEditorMode #tlacitkoVlozitObrazek {
  display: inline-flex !important;
}

#taskModal.sharingEditorMode .lubaNoteImage {
  pointer-events: auto;
}

#taskModal.sharingEditorMode #secretTaskButton,
#taskModal.sharingEditorMode .dateTimeInputs,
#taskModal.sharingEditorMode #pinTaskButton,
#taskModal.sharingEditorMode #reminderButton,
#taskModal.sharingEditorMode #deleteTaskButton {
  display: none !important;
}

/*
 * PATCH 462 – Shared používá stejnou praktickou spodní lištu jako běžný V2
 * editor. Uživatel musí mít při sdílené editaci po ruce oblast (domů/práce),
 * oblíbené, barvu zvýraznění, štítky, TODO a plánování. Koš, Secret, připnutí
 * a reminder zůstávají mimo Shared workflow.
 *
 * Pořadí je záměrně stabilní i na úzkém Androidu: Uložit, Oblast, Oblíbené,
 * Barva, Štítky, TODO a úplně poslední Naplánovat.
 */
#taskModal.sharingEditorMode .editorBottomBar {
  justify-content: space-between;
}

#taskModal.sharingEditorMode #editorBackButton,
#taskModal.sharingEditorMode #categoryTaskButton,
#taskModal.sharingEditorMode #priorityTaskButton,
#taskModal.sharingEditorMode #colorTaskButton,
#taskModal.sharingEditorMode #tagTaskButton,
#taskModal.sharingEditorMode #addTodoButton,
#taskModal.sharingEditorMode #planSelectionButton {
  display: inline-flex !important;
}

#taskModal.sharingEditorMode #editorBackButton { order: 1; }
#taskModal.sharingEditorMode #categoryTaskButton { order: 2; }
#taskModal.sharingEditorMode #priorityTaskButton { order: 3; }
#taskModal.sharingEditorMode #colorTaskButton { order: 4; }
#taskModal.sharingEditorMode #textColorPalette { order: 4; }
#taskModal.sharingEditorMode #tagTaskButton { order: 5; }
#taskModal.sharingEditorMode #addTodoButton { order: 6; }
#taskModal.sharingEditorMode #planSelectionButton { order: 7; }

.sharingReadOnlyHeaderText {
  min-width: 0;
  flex: 1 1 auto;
}

.sharingReadOnlyHeaderText h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--color-editor-text);
  font-size: calc(1rem + 0.3125rem);
  line-height: 1.2;
}

.sharingReadOnlyHeaderText p {
  margin: 5px 0 0;
  color: var(--color-accent);
  font-size: calc(1rem - 0.1875rem);
  font-weight: 750;
}

.sharingReadOnlyBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  box-sizing: border-box;
  padding: 18px 18px 36px;
}

.sharingReadOnlyContent {
  min-height: 30px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--color-editor-text);
  font-size: 1rem;
  line-height: 1.5;
}

.sharingReadOnlyContent img,
.sharingReadOnlyTodoText img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px auto;
  border-radius: 12px;
}

.sharingReadOnlyContent a,
.sharingReadOnlyTodoText a {
  color: var(--color-accent);
  overflow-wrap: anywhere;
}

.sharingReadOnlyTodos {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.sharingReadOnlyTodos[hidden] {
  display: none !important;
}

.sharingReadOnlyTodos h3 {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
  font-size: calc(1rem - 0.0625rem);
}

.sharingReadOnlyTodoList {
  display: grid;
  gap: 8px;
}

.sharingReadOnlyTodo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;

  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 13px;
  background: var(--color-background);
}

.sharingReadOnlyTodo input[type="checkbox"] {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  opacity: 1;
}

.sharingReadOnlyTodoText {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--color-editor-text);
  line-height: 1.4;
}

@media (max-width: 899px) {
  .sharingReadOnlyViewer {
    inset: auto 0 auto 0;
    top: var(--visual-top, 0px);
    width: 100%;
    height: var(--visual-height, 100dvh);
  }

  .sharingReadOnlyHeader {
    padding-top: max(9px, env(safe-area-inset-top));
  }

  .sharingReadOnlyBody {
    padding-bottom: max(72px, env(safe-area-inset-bottom));
  }
}


/* ============================================================
   S2D.1d – Shared editor UI + faithful read-only viewer
============================================================ */

/*
 * Shared note content has no shared date/time/reminder layer.
 * Hide the empty top-actions wrapper as well so toolbar gets the
 * whole row.
 */
#taskModal.sharingEditorMode .editorTopActions {
  display: none !important;
}

/*
 * PATCH 460 – Shared toolbar musí být na telefonu skutečně posuvný.
 * Původní S2D.1d ho natvrdo uzamkl přes overflow-x:hidden a snažil se všechny
 * nástroje vměstnat do jedné šířky. Na menších displejích tak pravá část
 * (zarovnání / obrázek / odkaz / Open / Save as / Bullet) zůstala mimo dosah.
 *
 * Každá úroveň toolbaru proto používá normální horizontální pan. Žádné kliky
 * ani V2 handlery se nemění – jde pouze o geometrii a scroll kontejneru.
 */
#taskModal.sharingEditorMode .editorQuickToolbar {
  justify-content: flex-start;
  gap: 4px;
  padding-inline: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
}

#taskModal.sharingEditorMode .editorQuickToolbar::-webkit-scrollbar {
  display: none;
}

#taskModal.sharingEditorMode .editorToolbarDivider {
  display: none !important;
}

#taskModal.sharingEditorMode .editorQuickToolbar > .editorQuickTool,
#taskModal.sharingEditorMode .editorQuickToolbar > .editorToolbarButton {
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
}

#taskModal.sharingEditorMode #editorToolsToolbar #tlacitkoNadpis {
  order: 1;
}

#taskModal.sharingEditorMode #editorToolsToolbar #textColorPanel {
  order: 2;
}

#taskModal.sharingEditorMode #editorToolsToolbar #textColorButton {
  order: 3;
}

#taskModal.sharingEditorMode #editorToolsToolbar #tlacitkoZarovnaniTextu {
  order: 4;
}

#taskModal.sharingEditorMode #editorToolsToolbar #tlacitkoVlozitObrazek {
  order: 5;
}

#taskModal.sharingEditorMode #editorToolsToolbar #tlacitkoVlozitOdkaz {
  order: 6;
}

#taskModal.sharingEditorMode #editorToolsToolbar #tlacitkoUlozitDokument {
  order: 7;
}

#taskModal.sharingEditorMode #editorToolsToolbar #tlacitkoBullet {
  order: 8;
}

/*
 * Read-only fullscreen follows the same useful width as the normal
 * editor instead of stretching TODO rows across a desktop monitor.
 */
.sharingReadOnlyContent,
.sharingReadOnlyTodos {
  width: 100%;
  max-width: 920px;
  box-sizing: border-box;
  margin-right: auto;
  margin-left: auto;
}

/*
 * Default alignment is left. Any explicit alignment stored in
 * richContent/todo.html remains authoritative on child elements.
 */
.sharingReadOnlyContent,
.sharingReadOnlyTodoText,
.sharingReadOnlyTodos h3 {
  text-align: left;
}

.sharingReadOnlyContent {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Preserve the normal LubaNote rich-text vocabulary in the viewer. */
.sharingReadOnlyContent .lubaNoteVlozenyText,
.sharingReadOnlyTodoText .lubaNoteVlozenyText {
  color: var(--color-editor-text);
  background-color: var(
    --luba-vlozeny-text-pozadi,
    var(--color-editor-background)
  );
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  font-variant: normal;
  line-height: inherit;
  letter-spacing: normal;
  text-decoration: none;
  text-transform: none;
  text-shadow: none;
  white-space: pre-wrap;
}

.sharingReadOnlyContent .richTextHighlight,
.sharingReadOnlyTodoText .richTextHighlight {
  color: inherit;
  font: inherit;
  line-height: inherit;
  white-space: inherit;
  overflow-wrap: inherit;
  word-break: inherit;
  padding: 0.08em 0.12em;
}

.sharingReadOnlyContent h1,
.sharingReadOnlyContent h2,
.sharingReadOnlyContent h3,
.sharingReadOnlyTodoText h1,
.sharingReadOnlyTodoText h2,
.sharingReadOnlyTodoText h3 {
  color: inherit;
  font-family: inherit;
  font-weight: 700;
}

.sharingReadOnlyContent h1,
.sharingReadOnlyTodoText h1 {
  margin: 0.55em 0 0.30em;
  font-size: 1.60em;
  line-height: 1.18;
}

.sharingReadOnlyContent h2,
.sharingReadOnlyTodoText h2 {
  margin: 0.50em 0 0.28em;
  font-size: 1.36em;
  line-height: 1.22;
}

.sharingReadOnlyContent h3,
.sharingReadOnlyTodoText h3 {
  margin: 0.45em 0 0.25em;
  font-size: 1.18em;
  line-height: 1.28;
}

.sharingReadOnlyContent ul,
.sharingReadOnlyContent ol,
.sharingReadOnlyTodoText ul,
.sharingReadOnlyTodoText ol {
  margin-block: 0.35em;
  padding-inline-start: 1.55em;
}

.sharingReadOnlyContent .lubaNoteInternetLink,
.sharingReadOnlyTodoText .lubaNoteInternetLink {
  color: var(--color-accent);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/*
 * Existing shared images keep their editor width/alignment.
 * Controls remain absent in read-only mode.
 */
.sharingReadOnlyContent .lubaNoteImage,
.sharingReadOnlyTodoText .lubaNoteImage {
  position: relative;
  width: min(100%, 720px);
  max-width: 100%;
  margin: 14px auto;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.sharingReadOnlyContent .lubaNoteImage[data-zarovnani="vlevo"],
.sharingReadOnlyTodoText .lubaNoteImage[data-zarovnani="vlevo"] {
  float: left;
  margin: 2px 4px 6px 0 !important;
}

.sharingReadOnlyContent .lubaNoteImage[data-zarovnani="vpravo"],
.sharingReadOnlyTodoText .lubaNoteImage[data-zarovnani="vpravo"] {
  float: right;
  margin: 2px 0 6px 3px !important;
}

.sharingReadOnlyContent .lubaNoteImage[data-velikost="50"][data-zarovnani="vlevo"],
.sharingReadOnlyContent .lubaNoteImage[data-velikost="50"][data-zarovnani="vpravo"],
.sharingReadOnlyTodoText .lubaNoteImage[data-velikost="50"][data-zarovnani="vlevo"],
.sharingReadOnlyTodoText .lubaNoteImage[data-velikost="50"][data-zarovnani="vpravo"] {
  width: calc(50% - 4px) !important;
}

/*
 * TODO preview now looks like the normal editor list: no giant card,
 * no forced centered text, and sane checkbox sizing.
 */
.sharingReadOnlyTodos {
  margin-top: 22px;
  padding-top: 16px;
}

.sharingReadOnlyTodoList {
  display: grid;
  gap: 6px;
}

.sharingReadOnlyTodo {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  width: 100%;
  box-sizing: border-box;
  padding: 3px 8px;

  border: 0;
  border-radius: 0;
  background: transparent;

  color: var(--color-editor-text);
  font-size: 1rem;
}

.sharingReadOnlyTodo input[type="checkbox"] {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  margin: 1px 0 0;
}

.sharingReadOnlyTodoText {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  padding: 0 0 4px;

  color: var(--color-editor-text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.35;

  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sharingReadOnlyTodoCompleted .sharingReadOnlyTodoText {
  opacity: 0.55;
  text-decoration: line-through;
}

@media (max-width: 600px) {
  #taskModal.sharingEditorMode .editorTopBar {
    gap: 0;
  }

  #taskModal.sharingEditorMode .editorTopBar .editorToolbarToggle {
    flex: 0 0 42px;
    width: 42px;
  }

  #taskModal.sharingEditorMode .editorQuickToolbar > .editorQuickTool,
  #taskModal.sharingEditorMode .editorQuickToolbar > .editorToolbarButton {
    min-width: 34px;
    max-width: 42px;
  }

  .sharingReadOnlyBody {
    padding-right: 14px;
    padding-left: 14px;
  }

  .sharingReadOnlyTodo {
    padding-right: 2px;
    padding-left: 2px;
  }
}


.sharingReadOnlyContent .lubaNoteImageSettings,
.sharingReadOnlyContent .lubaNoteImageRemove,
.sharingReadOnlyTodoText .lubaNoteImageSettings,
.sharingReadOnlyTodoText .lubaNoteImageRemove {
  display: none !important;
}

/* ============================================================
   S2E.4 – OVLÁDÁNÍ OBRÁZKU VE SHARED READ-ONLY
   ------------------------------------------------------------
   Shared čtecí kopie nikdy nezobrazuje editační ovladače obrázku.
   Aktivní editaci a její ovladače řídí výhradně Core V2.
============================================================ */


/* ============================================================
   PATCH 464 – V2 MIXED TODO VE SHARED READ-ONLY
   ------------------------------------------------------------
   data-lubanote-v2-todo je už součást autoritativního richContent.
   V čtecím režimu ho vykreslíme na jeho skutečné pozici a už ho
   neduplikuje samostatná kompatibilní note.todos sekce.
============================================================ */
.sharingReadOnlyContent.sharingReadOnlyV2Mixed
  [data-lubanote-v2-todo="true"] {
  position: relative;
  clear: both;
  min-height: 30px;
  box-sizing: border-box;
  padding: 2px 0 4px 40px;
}

.sharingReadOnlyContent.sharingReadOnlyV2Mixed
  [data-lubanote-v2-todo="true"]::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.12em;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: transparent;
}

.sharingReadOnlyContent.sharingReadOnlyV2Mixed
  [data-lubanote-v2-todo="true"][data-completed="true"]::before {
  border-color: var(--color-accent, currentColor);
  background: var(--color-accent, currentColor);
}

.sharingReadOnlyContent.sharingReadOnlyV2Mixed
  [data-lubanote-v2-todo="true"][data-completed="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 0.43em;
  width: 10px;
  height: 5px;
  box-sizing: border-box;
  border-left: 3px solid var(--color-accent-text, #fff);
  border-bottom: 3px solid var(--color-accent-text, #fff);
  transform: rotate(-45deg);
}

.sharingReadOnlyContent.sharingReadOnlyV2Mixed
  [data-lubanote-v2-todo="true"][data-completed="true"] {
  opacity: 0.62;
  text-decoration-line: line-through;
}

/* PATCH 474 – Shared stav muze mit druhy radek (Prave/Naposledy upravil). */
.taskCard .sharingSharedCardMeta,
.sharingReadOnlyHeaderText p {
  white-space: pre-line;
}

/* ============================================================
   PATCH 623 – Sharing text modaly nad LubaKeyboard
   ------------------------------------------------------------
   LubaKeyboard je vlastni fixed panel, proto na rozdil od systemove IME
   nezmensuje visualViewport. Mobilni @username modal byl zarovnany ke
   spodnimu okraji a klavesnice ho po tapu do pole prekryla.

   Zdrojem pravdy je skutecne zmerena --ln-lk-height z lubaKeyboard.js.
   Spodni hrana Sharing modalu proto konci tesne nad klavesnici a pri
   malem displeji se scrolluje karta, ne cely viewport.
   ============================================================ */
@media (max-width: 899px) {
  body.ln-luba-klavesnice-open .sharingIdentityModal:not([hidden]),
  body.ln-luba-klavesnice-open .sharingModal:not([hidden]) {
    align-items: flex-end;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: calc(var(--ln-lk-height, 260px) + 5px);
  }

  body.ln-luba-klavesnice-open .sharingIdentityModal:not([hidden]) .sharingIdentityCard,
  body.ln-luba-klavesnice-open .sharingModal:not([hidden]) .sharingModalCard {
    min-height: 0;
    max-height: calc(
      100dvh - var(--ln-lk-height, 260px) - 5px - max(10px, env(safe-area-inset-top))
    );
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   PATCH 630 – povinné @username při prvním vstupu
   ------------------------------------------------------------
   Povinný modal nemá Zrušit / X. Jediná akce je vytvoření identity.
   Geometrie nad LubaKeyboard z PATCH 623 zůstává beze změny.
   ============================================================ */
.sharingIdentityModalRequired .sharingIdentityActions {
  grid-template-columns: 1fr;
}

.sharingIdentityModalRequired .sharingIdentityPrimary {
  width: 100%;
}
