[data-jot-toggle], .nk-jot-close, .nk-jot-full {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 5px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--nk-shell-ink);
  cursor: pointer;
}
[data-jot-toggle] img { display: block; width: 32px; height: 32px; }
.nk-jot-head :is(button,a) svg { width: 18px; height: 18px; }
.nk-jot-full { color: var(--nk-shell-muted); }
[data-jot-toggle]:is(:hover,[aria-expanded="true"]) { background: var(--nk-shell-hover); }
[data-jot-toggle][aria-expanded="true"] { border-color: var(--nk-hover-border); }
.nk-jot-backdrop { display: none; }
.nk-jot-panel[hidden], .nk-jot-backdrop[hidden] { display: none !important; }
.nk-jot-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: clamp(350px, 36vw, 550px);
  min-height: 0;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--nk-shell-line);
  background: var(--nk-shell-bg);
}
.nk-jot-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 14px;
  border-bottom: 1px solid var(--nk-shell-line);
  background: var(--nk-shell-card);
}
.nk-jot-head h2 { flex: 1; margin: 0; font: 400 20px/1.2 var(--nk-title-font); }
.nk-jot-panel > iframe { display: block; flex: 1; width: 100%; min-height: 0; border: 0; }
@media screen {
  [data-jot-layout], [data-jot-main], .write-document, .write-document-body { display: flex; flex: 1; min-height: 0; min-width: 0; }
  [data-jot-main], .write-document { flex-direction: column; }
  .write-document-body > .sheet-wrap { min-width: 0; }
  .write-document > .ed-foot { flex: none; }
}
@media screen and (min-width: 801px) {
  .nk-jot-panel {
    margin: 4px 14px 12px 0;
    border-radius: var(--nk-radius-card);
    box-shadow: 0 3px 12px #221b3a0a;
  }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 801px) {
  .nk-jot-panel:not([hidden]) { animation: write-jot-slide .17s ease-out; }
  @keyframes write-jot-slide { from { transform: translateX(10px); opacity: .8; } }
}
@media screen and (max-width: 800px) {
  .ed-bar:has([data-jot-toggle]) > .ed-title { grid-column: 2 / 3; }
  .ed-bar > [data-jot-toggle] { grid-area: 1 / 3; justify-self: end; }
  [data-jot-toggle] img { width: 23px; height: 23px; }
  .nk-jot-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 73;
    background: var(--nk-backdrop);
  }
  .nk-jot-panel {
    position: fixed;
    z-index: 74;
    inset: auto 0 max(0px, calc(100dvh - var(--mobile-height, 100dvh)));
    width: 100%;
    height: calc(var(--mobile-height, 100dvh) * .79);
    min-height: min(290px, calc(var(--mobile-height, 100dvh) - 24px));
    max-height: calc(var(--mobile-height, 100dvh) - 24px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border: 1px solid var(--nk-shell-line);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: var(--nk-window-shadow);
  }
  .nk-jot-panel::before {
    content: '';
    z-index: 1;
    position: absolute;
    top: 8px;
    left: 50%;
    translate: -50% 0;
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: var(--nk-shell-line);
    pointer-events: none;
  }
  .nk-jot-head { padding-top: 12px; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 800px) {
  .nk-jot-panel:not([hidden]) { animation: write-jot-rise .19s ease-out; }
  @keyframes write-jot-rise { from { transform: translateY(36px); opacity: .8; } }
}
@media print { .nk-jot-panel, [data-jot-toggle], .nk-jot-backdrop { display: none !important; } }

[data-jot-main] > :is(.present-ribbon, .grid-ribbon, #tools) { flex-shrink: 0; }
[data-jot-service="forms"] [data-jot-layout] { width: 100%; }
[data-jot-service="forms"] [data-jot-main] > #main { width: 100%; min-width: 0; }
@media screen and (min-width: 801px) {
  [data-jot-service="nkmail"] .thread-head [data-jot-toggle] { display: none; }
  [data-jot-service="nkmail"]:has(> .nk-jot-panel:not([hidden])) {
    grid-template-columns: minmax(225px, min(25vw, 372px)) minmax(0, 1fr) clamp(340px, 30vw, 500px);
  }
  [data-jot-service="nkmail"] > .nk-jot-panel { width: auto; margin: 10px 12px 10px 0; }
}
@media screen and (min-width: 801px) and (max-width: 1100px) {
  [data-jot-service="nkmail"]:has(> .nk-jot-panel:not([hidden])) {
    grid-template-columns: minmax(250px, 33vw) minmax(0, 1fr);
  }
  [data-jot-service="nkmail"] > .nk-jot-panel {
    position: fixed;
    z-index: 20;
    inset: 10px 12px 10px auto;
    width: min(390px, 45vw);
    margin: 0;
    box-shadow: var(--nk-window-shadow);
  }
}
