:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #687386;
  --line: #d5dbe3;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --control-bg: #ffffff;
  --soft-panel: #f8fafc;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --shadow: 0 10px 28px rgba(24, 33, 47, 0.08);
  --modal-bg: #f3f6f8;
  --modal-panel: #ffffff;
  --modal-stage: #e8edf2;
  --modal-ink: #18212f;
  --modal-muted: #687386;
  --modal-line: rgba(103, 114, 128, 0.26);
  --chat-panel: #ffffff;
  --chat-bubble-left: #f8fafc;
  --chat-bubble-right: #eaf7f4;
  --chat-bubble-border: #d7e2ef;
  --chat-status-bg: #edf7f5;
  --chat-status-unread-bg: #fff7ed;
  --chat-input-bg: #ffffff;
  --topbar-sticky-offset: 54px;
  --modal-chat-width: 390px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1119;
  --panel: #162131;
  --ink: #edf4ff;
  --muted: #a9b7ca;
  --line: #2c3a4e;
  --accent: #7cc7ff;
  --accent-dark: #a7dcff;
  --warn: #f6c66d;
  --danger: #fb7185;
  --control-bg: #1c2838;
  --soft-panel: #1b2737;
  --topbar-bg: rgba(11, 17, 25, 0.96);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  --modal-bg: #101722;
  --modal-panel: #151f2c;
  --modal-stage: #0b111b;
  --modal-ink: #f8fafc;
  --modal-muted: #b8c2d2;
  --modal-line: rgba(255, 255, 255, 0.14);
  --chat-panel: #151f2d;
  --chat-bubble-left: #1e2b3b;
  --chat-bubble-right: #24344a;
  --chat-bubble-border: rgba(255, 255, 255, 0.06);
  --chat-status-bg: #223047;
  --chat-status-unread-bg: #2b3b52;
  --chat-input-bg: #1b2737;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", Arial, sans-serif;
}

.loginOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: auto;
  background:
    linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(236, 241, 239, 0.94)),
    #eef1f4;
}

body[data-theme="dark"] .loginOverlay {
  background:
    linear-gradient(135deg, rgba(16, 23, 34, 0.96), rgba(20, 28, 40, 0.94)),
    #10151d;
}

.loginOverlay.hidden {
  display: none;
}

.loginShell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 430px);
  width: min(1120px, 100%);
  min-height: min(680px, calc(100vh - 56px));
  border: 1px solid rgba(108, 117, 125, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(24, 33, 47, 0.2);
}

.loginArtwork {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  background: #f9faf7;
}

.loginHeroImage {
  width: 100%;
  height: 100%;
  min-height: 460px;
  object-fit: cover;
  object-position: 56% center;
  display: block;
}

.loginArtwork::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.72) 100%),
    linear-gradient(0deg, rgba(24, 33, 47, 0.36), rgba(24, 33, 47, 0) 52%);
  pointer-events: none;
}

.loginArtworkCaption {
  position: absolute;
  left: 22px;
  bottom: 24px;
  z-index: 1;
  display: grid;
  gap: 4px;
  max-width: 360px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(24, 33, 47, 0.38);
}

.loginArtworkCaption span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.loginArtworkCaption strong {
  font-size: 30px;
  line-height: 1.05;
}

.loginSketchStrip {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.loginSketchStrip img {
  width: clamp(136px, 12.8vw, 168px);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  object-position: center;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(24, 33, 47, 0.24);
  background: #fff;
}

.loginBox {
  display: grid;
  align-content: center;
  gap: 16px;
  width: 100%;
  padding: clamp(28px, 5vw, 48px);
  background:
    linear-gradient(180deg, #fff 0%, #fbfaf6 100%);
}

body[data-theme="dark"] .loginBox {
  background: linear-gradient(180deg, #151d28 0%, #111827 100%);
}

body[data-theme="dark"] .loginEyebrow,
body[data-theme="dark"] .loginLangSwitch {
  border-color: #5a4a2d;
  background: #282113;
  color: #f8dca4;
}

.loginIntro {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.loginEyebrow {
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #d9c7a7;
  border-radius: 6px;
  color: #7b4d12;
  background: #fff7e8;
  font-size: 12px;
  font-weight: 700;
}

.loginIntro h1 {
  font-size: 30px;
  line-height: 1;
}

.loginIntro p,
.loginHint {
  color: var(--muted);
}

.loginField span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

.loginField input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--ink);
  font-size: 15px;
}

.loginField input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.loginSubmit {
  min-height: 46px;
  margin-top: 4px;
  font-weight: 800;
}

.loginHint {
  font-size: 13px;
}

.loginBox #loginMessage {
  min-height: 20px;
}

.loginLangSwitch {
  justify-self: start;
  margin: -2px 0 2px;
  border-color: #d8c6a6;
  background: #fffaf0;
  box-shadow: 0 8px 22px rgba(97, 70, 28, 0.1);
}

.loginLangSwitch button {
  min-width: 72px;
  min-height: 34px;
  padding: 0 12px;
  font-weight: 800;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 238px 8px 150px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
}

.brandLine {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}

.brandLine h1 {
  position: absolute;
  left: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

h2 {
  margin-bottom: 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

h3 {
  font-size: 15px;
}

.actions {
  display: none;
}

.sectionSwitch,
.langSwitch {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--control-bg);
}

.sectionSwitch {
  overflow-x: auto;
  scrollbar-width: thin;
}

.sectionSwitch button,
.langSwitch button {
  position: relative;
  border: 0;
  border-radius: 0;
}

.sectionBadgeBridge {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  gap: 5px;
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: visible;
  background: var(--control-bg);
  transition: width 0.16s ease, min-width 0.16s ease;
}

.sectionBadgeBridge.has-badges {
  width: 42px;
  min-width: 42px;
  padding: 0 5px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.sectionBadgeBridge.multi-badge {
  width: 74px;
  min-width: 74px;
}

.sectionBadgeBridge.triple-badge {
  width: 110px;
  min-width: 110px;
}

.sectionUnreadBadge {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--control-bg);
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(185, 28, 28, 0.32);
  pointer-events: none;
}

.sectionBadgeBridge .sectionUnreadBadge {
  position: static;
  top: auto;
  right: auto;
  left: auto;
  flex: 0 0 auto;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border-color: var(--control-bg);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.32);
}

.sectionBadgeBridge .sectionUnreadBadge.message {
  background: #e11d48;
  color: #fff;
}

.sectionUnreadBadge.status {
  right: auto;
  left: 3px;
  background: #f59e0b;
  box-shadow: 0 6px 14px rgba(180, 83, 9, 0.28);
}

.sectionBadgeBridge .sectionUnreadBadge.status {
  right: auto;
  left: auto;
  background: #fbbf24;
  color: #4a2c00;
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.26);
}

.sectionBadgeBridge .sectionUnreadBadge.translation {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.26);
}

.sectionSwitch button.active .sectionUnreadBadge {
  border-color: var(--ink);
}

body[data-theme="dark"] .sectionUnreadBadge {
  border-color: var(--control-bg);
  background: #fb7185;
  color: #141b25;
}

body[data-theme="dark"] .sectionUnreadBadge.status {
  background: #fbbf24;
  color: #141b25;
}

body[data-theme="dark"] .sectionBadgeBridge {
  background: var(--control-bg);
}

body[data-theme="dark"] .sectionBadgeBridge.has-badges {
  border-color: rgba(255, 255, 255, 0.14);
}

body[data-theme="dark"] .sectionBadgeBridge .sectionUnreadBadge.message {
  background: #fb7185;
  color: #141b25;
}

body[data-theme="dark"] .sectionBadgeBridge .sectionUnreadBadge.status {
  background: #facc15;
  color: #141b25;
}

body[data-theme="dark"] .sectionBadgeBridge .sectionUnreadBadge.translation {
  background: #93c5fd;
  color: #07111b;
}

body[data-theme="dark"] .sectionSwitch button.active .sectionUnreadBadge {
  border-color: #2dd4bf;
}

.topRightControls {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.imageModalOpen .topRightControls {
  visibility: hidden;
  pointer-events: none;
}

.globalLangSwitch {
  width: 150px;
  height: 36px;
  box-shadow: 0 8px 24px rgba(24, 33, 47, 0.16);
}

.globalLangSwitch button {
  width: 50px;
  min-height: 34px;
  padding: 0;
  font-weight: 700;
}

body.loginOpen .globalLangSwitch {
  display: none;
}

.themeToggleBtn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--control-bg);
  box-shadow: 0 8px 24px rgba(24, 33, 47, 0.16);
  font-size: 16px;
  line-height: 1;
}

.sectionSwitch button.active,
.langSwitch button.active {
  background: var(--ink);
  color: #fff;
}

body[data-theme="dark"] .sectionSwitch button.active,
body[data-theme="dark"] .langSwitch button.active {
  background: var(--accent);
  color: #07111b;
}

.accountWrap {
  position: relative;
}

.accountWrap.hidden {
  display: none;
}

.accountBtn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(24, 33, 47, 0.16);
  font-weight: 800;
  letter-spacing: 0;
}

.accountBtn:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.accountMenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 410;
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(24, 33, 47, 0.18);
}

.accountMenu.hidden {
  display: none;
}

.accountName {
  color: var(--muted);
  font-size: 13px;
}

.saveState {
  min-width: 96px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  white-space: nowrap;
}

.saveState.good {
  border-color: #a7d8ce;
  color: var(--accent-dark);
  background: #effaf7;
}

.saveState.pending {
  border-color: #f0c779;
  color: var(--warn);
  background: #fff8eb;
}

.saveState.error {
  border-color: #efb4b4;
  color: var(--danger);
  background: #fff2f2;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--control-bg);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #aeb8c5;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-dark);
}

body[data-theme="dark"] button,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  border-color: var(--line);
  background: var(--control-bg);
  color: var(--ink);
}

body[data-theme="dark"] option {
  background: #202b3a;
  color: #f3f7fb;
}

body[data-theme="dark"] button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #07111b;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary {
  width: 100%;
  margin-top: 8px;
}

.layout {
  display: block;
  padding: 18px;
}

.content {
  width: min(1640px, 100%);
  margin: 0 auto;
}

.toolbarMessage {
  width: min(1640px, calc(100% - 36px));
  min-height: 24px;
  margin: 10px auto 0;
}

.toolbarMessage:empty {
  min-height: 0;
  margin-top: 0;
}

.contactToolbar {
  position: sticky;
  top: calc(var(--topbar-sticky-offset) + 4px);
  z-index: 19;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  width: min(1640px, calc(100% - 36px));
  margin: 4px auto 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.contactToolbar.hidden {
  display: none;
}

.contactToolbarGroup {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.contactToolbarActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.ownerOnlyToolbar {
  min-width: 0;
}

body:not([data-role="owner"]) .ownerOnlyToolbar {
  display: none;
}

.gridToolbarGroup {
  gap: 6px;
  flex: 0 0 auto;
}

.gridToolbarLabel {
  color: var(--muted);
  font-size: 13px;
}

.gridStepControl {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
}

.gridStepControl button {
  min-width: 30px;
  min-height: 28px;
  padding: 3px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.gridStepControl button:last-child {
  border-right: 0;
}

.gridStepControl button.active {
  background: var(--accent);
  color: #fff;
}

body[data-theme="dark"] .gridStepControl button.active {
  color: #07111b;
}

#selectModeBtn.active {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: var(--accent);
  color: #fff;
}

body[data-theme="dark"] #selectModeBtn.active {
  color: #07111b;
}

.compactLightControl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.compactLightControl select {
  width: auto;
  min-height: 30px;
}

.selectedCounter {
  color: var(--muted);
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 82px;
  align-self: start;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 100px);
  overflow: auto;
}

.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel a {
  display: block;
  margin: 8px 0;
  color: var(--accent-dark);
  text-decoration: none;
}

.panel a:hover {
  text-decoration: underline;
}

#searchInput,
.field input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--control-bg);
  color: var(--ink);
}

#searchInput,
.field input,
select {
  min-height: 36px;
  padding: 7px 9px;
}

textarea {
  resize: vertical;
  min-height: 76px;
  padding: 9px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink);
}

.check input,
.cardControls input {
  width: auto;
}

.stats {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.message {
  margin-top: 10px;
  color: var(--muted);
  word-break: break-word;
}

.message.error {
  color: var(--danger);
}

.message.good {
  color: var(--accent-dark);
}

.toastHost {
  position: fixed;
  top: calc(var(--topbar-sticky-offset) + 14px);
  right: 18px;
  z-index: 520;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(24, 33, 47, 0.18);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.toast.error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.toast.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.toast button {
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
}

body[data-theme="dark"] .toast {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .toast.error {
  border-color: #7f1d1d;
  background: #3b1116;
  color: #fda4af;
}

body[data-theme="dark"] .toast.good {
  border-color: #14532d;
  background: #092516;
  color: #86efac;
}

.cards {
  display: grid;
  gap: 16px;
}

.cards.contactSheetGrid {
  --contact-grid-columns: 8;
  grid-template-columns: repeat(var(--contact-grid-columns), minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.emptyState {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.card {
  display: grid;
  grid-template-columns: minmax(420px, min(52%, 780px)) minmax(420px, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

@media (min-width: 761px) {
  .card:not(.contactSheetCard):not(.originalTextCard) {
    --work-image-height: clamp(420px, 34vw, 620px);
    --work-meta-height: 78px;
    --work-card-top-height: 32px;
    align-items: stretch;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .imagePane,
  .card:not(.contactSheetCard):not(.originalTextCard) .editPane {
    height: calc(var(--work-card-top-height) + var(--work-image-height) + var(--work-meta-height));
    min-height: 0;
    overflow: hidden;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .imagePane {
    display: flex;
    flex-direction: column;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .cardTopLine {
    flex: 0 0 var(--work-card-top-height);
    margin-bottom: 6px;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .imageWrap {
    flex: 0 0 var(--work-image-height);
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .fileName {
    flex: 0 0 auto;
    min-height: 18px;
    max-height: 18px;
    overflow: hidden;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .markupSummary {
    flex: 0 0 auto;
    max-height: 52px;
    overflow-y: auto;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .commentThread {
    height: 100%;
    min-height: 0;
  }
}

@media (min-width: 1241px) {
  .card:not(.contactSheetCard):not(.originalTextCard) {
    align-items: start;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .imagePane {
    height: auto;
    overflow: visible;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .editPane {
    height: var(--actual-card-image-height, var(--work-image-height));
    margin-top: calc(var(--work-card-top-height) + 6px);
    align-self: start;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .commentThread {
    height: 100%;
  }
}

body[data-role="client"] .sidebar,
body[data-role="client"] .refsField,
body[data-role="client"] .refsInput {
  display: none;
}

body[data-role="client"] .layout {
  display: block;
}

body[data-role="client"] .card {
  grid-template-columns: minmax(420px, min(52%, 780px)) minmax(420px, 1fr);
}

body[data-role="client"] textarea {
  border-color: transparent;
  background: var(--soft-panel);
}

body[data-lang="ru"] .enField,
body[data-lang="ru"] .enChatField,
body[data-lang="en"] .ruField,
body[data-lang="en"] .ruChatField {
  display: none;
}

.clientCommentBox {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #b8d8d4;
  border-radius: 8px;
  background: var(--panel);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.clientCommentBox textarea {
  background: var(--control-bg);
  border-color: var(--line);
}

.clientCommentActions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.imagePane {
  min-width: 0;
}

.cardTopLine {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  margin-bottom: 10px;
}

.imageVersionSwitch {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  max-width: 100%;
  padding: 3px;
  border: 1px solid rgba(24, 33, 47, 0.16);
  border-radius: 999px;
  background: color-mix(in srgb, var(--control-bg) 92%, transparent);
  box-shadow: 0 6px 20px rgba(24, 33, 47, 0.16);
}

.imageVersionBtn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.imageVersionBtn.latest {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  padding: 0;
  border-radius: 50%;
  color: #8a4b0b;
  background: #fff7ed;
  border-color: #f0b454;
  box-shadow: 0 5px 14px rgba(180, 83, 9, 0.18);
}

.imageVersionBtn.latest.active {
  color: #fff;
  background: #f59e0b;
  border-color: #d97706;
}

.imageVersionBtn.stale {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  padding: 0;
  border-style: dashed;
  border-radius: 50%;
  color: #8792a3;
  background: rgba(255, 255, 255, 0.78);
  border-color: #cbd5e1;
  box-shadow: none;
  opacity: 0.74;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imageVersionBtn.stale.active,
.imageVersionBtn.selectedStale {
  color: #7c4d12;
  background: #fffaf0;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
  opacity: 1;
}

body[data-theme="dark"] .imageVersionBtn.latest {
  color: #fcd34d;
  background: #332514;
  border-color: #f59e0b;
  box-shadow: none;
}

body[data-theme="dark"] .imageVersionBtn.latest.active {
  color: #111827;
  background: #fbbf24;
  border-color: #f59e0b;
}

body[data-theme="dark"] .imageVersionBtn.stale {
  color: #98a6ba;
  background: rgba(31, 41, 55, 0.82);
  border-color: #475569;
  opacity: 0.74;
}

body[data-theme="dark"] .imageVersionBtn.stale.active,
body[data-theme="dark"] .imageVersionBtn.selectedStale {
  color: #fcd34d;
  background: rgba(120, 83, 28, 0.35);
  border-color: #f59e0b;
  opacity: 1;
}

body[data-theme="dark"] .imageVersionSwitch,
body[data-theme="dark"] .imageWrap .cardStatusInline {
  border-color: rgba(255, 255, 255, 0.18);
  background: color-mix(in srgb, var(--control-bg) 90%, transparent);
}

.imageVersionBtn.add {
  border-style: dashed;
}

.cardTitle {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: 0;
  word-break: break-word;
}

.cardTitleText {
  min-width: 0;
}

.journalFrameStar,
.journalFrameToggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid #f2d59f;
  border-radius: 999px;
  background: #fff7ed;
  color: #b77900;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.16);
}

.journalFrameToggle {
  padding: 0;
  cursor: pointer;
}

.journalFrameToggle:not(.isMarked) {
  color: #8b97a8;
  border-color: #d5dce6;
  background: #fff;
  box-shadow: none;
}

.journalFrameToggle:hover,
.journalFrameToggle:focus-visible {
  border-color: #d99a00;
  color: #b77900;
}

.journalFrameToggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.journalFrameToggle:disabled {
  cursor: progress;
  opacity: 0.58;
}

body[data-theme="dark"] .journalFrameStar,
body[data-theme="dark"] .journalFrameToggle.isMarked {
  border-color: #7c4d12;
  background: #3a2a12;
  color: #facc15;
  box-shadow: none;
}

body[data-theme="dark"] .journalFrameToggle:not(.isMarked) {
  border-color: #475569;
  background: #172033;
  color: #94a3b8;
}

.selectCheck {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card:not(.contactSheetCard) .selectCheck {
  display: none;
}

.selectCheck input {
  width: auto;
}

.imageWrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-panel);
  overflow: hidden;
}

.imageLoadingIndicator {
  display: grid;
  place-items: center;
  gap: 10px;
  color: var(--muted);
}

.loadingSpinner {
  display: block;
  width: 44px;
  height: 44px;
  border: 4px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: imageLoadingSpinnerTurn 0.8s linear infinite;
}

.operationSpinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: imageLoadingSpinnerTurn 0.8s linear infinite;
}

.imageRevisionProgress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 7px 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.imageRevisionProgress.hidden {
  display: none;
}

.imageVersionSwitch.isMutationPending,
.modalImageVersionSwitch.isMutationPending {
  cursor: wait;
}

.cardImageLoading {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--soft-panel) 88%, transparent);
  pointer-events: none;
}

.cardImageLoading .loadingLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.imageWrap:not(.isImageLoading) .cardImageLoading,
.imageWrap.isMissing .cardImageLoading {
  display: none;
}

@keyframes imageLoadingSpinnerTurn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loadingSpinner,
  .operationSpinner {
    animation-duration: 1.6s;
  }
}

.card:not(.contactSheetCard):not(.originalTextCard) .imageWrap {
  height: clamp(420px, 34vw, 620px);
  min-height: 0;
  background: #eef3f4;
}

.card.layoutPilotCard:not(.contactSheetCard):not(.originalTextCard) .imageWrap {
  flex: 0 0 auto;
  height: auto;
  aspect-ratio: var(--source-frame-ratio, 1.483129 / 1);
  background: #fff;
}

.layoutArtwork {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  transform-origin: center center;
  will-change: transform;
}

.publisherContentLayer {
  position: absolute;
  z-index: 2;
  display: block;
  max-width: none;
  max-height: none;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.publisherContentLayer.hidden {
  display: none;
}

.markupOverlayThumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}

.imageWrap.isMissing {
  min-height: 220px;
}

.imagePlaceholder {
  display: none;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.imageWrap.isMissing .storyImage,
.imageWrap.isMissing .openImageBtn {
  display: none;
}

.imageWrap.isMissing .imagePlaceholder {
  display: block;
}

.openImageBtn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 5;
  border-color: rgba(24, 33, 47, 0.35);
  background: color-mix(in srgb, var(--control-bg) 92%, transparent);
  box-shadow: 0 6px 20px rgba(24, 33, 47, 0.16);
}

.storyImage {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(62vh, 680px);
  object-fit: contain;
  cursor: zoom-in;
}

.card:not(.contactSheetCard):not(.originalTextCard) .storyImage {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.card.layoutPilotCard:not(.contactSheetCard):not(.originalTextCard) .storyImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: fill;
}

.layoutGuideLayer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--layout-guide-opacity, 0.46);
}

.layoutGuideLayer.hidden {
  display: none;
}

.layoutGuide {
  position: absolute;
  box-sizing: border-box;
}

.layoutGuideVector {
  position: absolute;
  display: block;
  overflow: hidden;
}

.layoutGuideVectorPath {
  stroke: rgba(61, 102, 160, 0.92);
}

.layoutGuideVectorPath.bleed {
  stroke: rgba(190, 24, 93, 0.9);
}

.layoutGuideVectorPath.trim {
  stroke: rgba(220, 72, 59, 0.96);
}

.layoutGuideVectorPath.safeOriginal {
  stroke: rgba(32, 132, 73, 0.9);
}

.layoutGuideVectorPath.safe {
  stroke: rgba(37, 99, 235, 0.94);
}

.layoutGuideVectorPath.structure {
  stroke: rgba(61, 102, 160, 0.92);
}

.layoutGuide.bleed {
  z-index: 3;
  border: 1px dashed rgba(190, 24, 93, 0.9);
}

.layoutGuide.trim {
  z-index: 3;
  border: 2px dashed rgba(220, 72, 59, 0.96);
}

.layoutGuide.wrap {
  z-index: 0;
  background: rgba(71, 85, 105, 0.22);
}

.layoutGuide.visibleFace {
  z-index: 1;
  border: 1px solid rgba(71, 85, 105, 0.78);
}

.layoutGuide.safe {
  z-index: 2;
  border: 1px dashed rgba(32, 132, 73, 0.9);
}

.layoutGuideLayer[data-layout-template="interior_spread"] .layoutGuide.safe {
  border-color: rgba(37, 99, 235, 0.94);
}

.layoutGuide.typeEnvelope {
  z-index: 2;
  border: 1px dashed rgba(13, 148, 136, 0.92);
}

.layoutGuide.keepout {
  z-index: 2;
  border: 1px solid rgba(234, 88, 12, 0.92);
  background: rgba(234, 88, 12, 0.08);
}

.layoutGuide.structure.vertical {
  z-index: 2;
  width: 0;
  border-left: 1px dashed rgba(15, 118, 110, 0.92);
}

.layoutGuide.structure.horizontal {
  z-index: 2;
  height: 0;
  border-top: 1px dashed rgba(15, 118, 110, 0.92);
}

.layoutGuideLayer[data-layout-template="cover_flat"] .layoutGuide.structure.vertical {
  border-left-color: rgba(59, 130, 246, 0.94);
}

.layoutGuideLayer[data-layout-template="cover_flat"] .layoutGuide.structure.horizontal {
  border-top-color: rgba(59, 130, 246, 0.94);
}

.layoutGuide.gutter.vertical {
  border-left: 2px dashed rgba(61, 102, 160, 0.92);
}

.layoutGuide.gutter.horizontal {
  border-top: 2px dashed rgba(61, 102, 160, 0.92);
}

.layoutGuideLayer.isPreview .layoutGuide.trim {
  border-width: 1.5px;
}

.card:not(.contactSheetCard):not(.originalTextCard) .markupOverlayThumb {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: transparent;
}

.fileName {
  margin-top: 8px;
  color: var(--muted);
  word-break: break-word;
}

.markupSummary {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  padding: 8px;
  border-left: 3px solid #0f766e;
  background: #f0fdfa;
  color: var(--ink);
  font-size: 13px;
}

.markupSummary small {
  color: var(--muted);
}

body[data-theme="dark"] .markupSummary {
  border-left-color: #2dd4bf;
  background: #102b2b;
  color: var(--ink);
}

.originalRefsPreview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.originalRefsPreview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.editPane {
  min-width: 0;
  display: grid;
}

.commentThread {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  min-height: 100%;
  align-self: stretch;
}

.card.originalTextCard {
  grid-template-columns: minmax(280px, 1fr);
}

.card.originalTextCard .commentThread,
.card.originalTextCard .markupSummary {
  display: none;
}

.card.originalTextCard .storyImage {
  max-height: min(68vh, 620px);
}

.card.originalTextCard .imageWrap {
  min-height: 0;
  padding: 8px;
}

.originalTextPageSet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  width: 100%;
}

.originalTextPageSet a,
.originalTextPageButton {
  display: grid;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
}

.originalTextPageSet img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(68vh, 620px);
  object-fit: contain;
}

.card.contactSheetCard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  overflow: visible;
}

.card.contactSheetCard .cardTopLine {
  display: none;
}

.card.contactSheetCard .editPane,
.card.contactSheetCard .openImageBtn,
.card.contactSheetCard .markupSummary {
  display: none;
}

.card.contactSheetCard .selectCheck {
  display: none;
  position: absolute;
  top: calc(var(--contact-card-header-height) + var(--contact-card-gap) + 5px);
  left: 6px;
  z-index: 3;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11px;
  line-height: 1;
}

.cards.contactSelectionMode .card.contactSheetCard .selectCheck {
  display: inline-flex;
}

.card.contactSheetCard.isSelected .imageWrap {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.card.contactSheetCard.isSelected {
  box-shadow: none;
}

.card.contactSheetCard .imagePane {
  display: grid;
  --contact-card-header-height: 24px;
  --contact-card-gap: 2px;
  grid-template-rows: var(--contact-card-header-height) minmax(0, 1fr);
  gap: var(--contact-card-gap);
  position: relative;
}

.card.contactSheetCard .imageWrap {
  min-height: 0;
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: 0;
  background: #fff;
  overflow: hidden;
}

.card.contactSheetCard .storyImage {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
}

.card.contactSheetCard .imageWrap.isMissing .storyImage {
  display: none;
}

.card.contactSheetCard .imageWrap.isMissing .imagePlaceholder {
  display: grid;
}

.card.contactSheetCard .fileName {
  font-size: 13px;
  color: var(--ink);
}

.card.contactSheetCard .fileName:empty {
  display: none;
}

.contactNavMeta {
  display: block;
  min-width: 0;
}

.contactNavTitleRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 24px;
  height: 24px;
}

.contactNavTitleGroup {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.contactNavTitle {
  min-width: 0;
  font-weight: 700;
  font-size: 11.5px;
  line-height: 14px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contactJournalStar {
  flex: 0 0 auto;
  margin: 0;
  color: #d99a00;
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

body[data-theme="dark"] .contactJournalStar {
  color: #facc15;
  text-shadow: none;
}

.contactNavStatusTarget {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  cursor: help;
}

.contactNavStatus {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 24, 40, 0.18);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.16);
}

.contactNavStatusTarget:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contactNavStatus.statusColor-draft {
  background: #94a3b8;
}

.contactNavStatus.statusColor-waiting_revision {
  background: #f59e0b;
}

.contactNavStatus.statusColor-accepted_editing,
.contactNavStatus.statusColor-approved {
  background: #16a34a;
}

.contactNavStatus.statusColor-moved_to_spreads {
  background: #2563eb;
}

.contactNavStatus.statusColor-rejected_discuss {
  background: #dc2626;
}

.statusColor-draft {
  background: #eef2f7;
  color: #526071;
}

.statusColor-waiting_revision {
  background: #fff7ed;
  color: #9a4b00;
}

.statusColor-accepted_editing {
  background: #eef6ff;
  color: #1d4f91;
}

.statusColor-rejected_discuss {
  background: #fff1f2;
  color: #b42318;
}

.statusColor-approved {
  background: #ecfdf3;
  color: #067647;
}

.statusColor-moved_to_spreads {
  background: #eff6ff;
  color: #1d4ed8;
}

body[data-theme="dark"] .statusColor-draft {
  background: #273244;
  color: #d6deeb;
}

body[data-theme="dark"] .statusColor-waiting_revision {
  background: #3a2a12;
  color: #f9d58a;
}

body[data-theme="dark"] .statusColor-accepted_editing {
  background: #14314d;
  color: #a9d4ff;
}

body[data-theme="dark"] .statusColor-rejected_discuss {
  background: #441d27;
  color: #ffb4c0;
}

body[data-theme="dark"] .statusColor-approved {
  background: #123423;
  color: #9ff0bd;
}

body[data-theme="dark"] .statusColor-moved_to_spreads {
  background: #172554;
  color: #bfdbfe;
}

.contactNavHint {
  display: none;
  color: var(--muted);
  font-size: 13px;
}

.card.contactSheetCard .contactBadgeGroup {
  position: absolute;
  top: calc(var(--contact-card-header-height) + var(--contact-card-gap) + 5px);
  right: 5px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: calc(100% - 10px);
}

.contactBadge {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(185, 28, 28, 0.34);
}

.contactBadge.status {
  background: #f59e0b;
  box-shadow: 0 8px 18px rgba(180, 83, 9, 0.28);
}

.contactBadge.translation {
  background: #7c3aed;
  box-shadow: 0 8px 18px rgba(91, 33, 182, 0.28);
}

body[data-theme="dark"] .contactBadge {
  border-color: var(--bg);
  background: #fb7185;
  color: #141b25;
}

body[data-theme="dark"] .contactBadge.status {
  background: #fbbf24;
}

body[data-theme="dark"] .contactBadge.translation {
  background: #c4b5fd;
}

.deadlineBadge {
  width: max-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid #f2d59f;
  border-radius: 6px;
  background: #fff7ed;
  color: #8a4b08;
  font-size: 12px;
  font-weight: 700;
}

.field {
  display: block;
  margin-top: 10px;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.commentsHeader {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  padding-top: 0;
}

.statusInline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.statusInline span {
  display: inline;
}

.cardStatusInline {
  flex: 0 0 auto;
}

.imageWrap .cardStatusInline {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  max-width: min(62%, 260px);
  padding: 3px;
  border: 1px solid rgba(24, 33, 47, 0.14);
  border-radius: 999px;
  background: color-mix(in srgb, var(--control-bg) 92%, transparent);
  box-shadow: 0 6px 20px rgba(24, 33, 47, 0.16);
}

.imageWrap .cardStatusInline span {
  display: none;
}

.imageWrap .statusSelect {
  max-width: 100%;
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.statusSelect {
  max-width: 220px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 26px 4px 10px;
  background: var(--control-bg);
  color: var(--ink);
  font-size: 12px;
}

.statusSelect:disabled {
  opacity: 1;
  color: var(--muted);
  background: var(--soft-panel);
}

.comments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--chat-panel);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding-bottom: 12px;
}

.comments::before {
  content: "";
  margin-top: auto;
}

.comment {
  position: relative;
  width: fit-content;
  max-width: min(88%, 680px);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft-panel);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.comment.left {
  align-self: flex-start;
  border-color: var(--chat-bubble-border);
  background: var(--chat-bubble-left);
}

.comment.right {
  align-self: flex-end;
  border-color: var(--chat-bubble-border);
  background: var(--chat-bubble-right);
}

.comment.unread {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent), 0 8px 24px rgba(18, 132, 118, 0.12);
}

.comment.unread.reading {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent), 0 10px 28px rgba(18, 132, 118, 0.18);
}

.comment.readConfirmed {
  animation: commentReadFade 780ms ease-out;
}

.commentUnreadMark {
  position: absolute;
  top: -9px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(18, 132, 118, 0.22);
  pointer-events: none;
}

.commentEventUnreadMark {
  position: absolute;
  top: -9px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(180, 83, 9, 0.26);
  pointer-events: none;
}

.commentNotice.hasAction {
  padding-right: 38px;
}

.commentNoticeDeleteBtn {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--control-bg) 92%, transparent);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transform: translateY(-50%);
}

.commentNoticeDeleteBtn:hover {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.comment.left .commentUnreadMark {
  left: 10px;
  right: auto;
}

@keyframes commentReadFade {
  0% {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
  }
  100% {
    box-shadow: none;
  }
}

body[data-theme="dark"] .comments {
  border-color: #607086;
  background: color-mix(in srgb, var(--panel) 94%, #223148);
}

body[data-theme="dark"] .comment.left,
body[data-theme="dark"] .comment.right {
  border-color: #688199;
}

body[data-theme="dark"] .comment.right {
  background: #123336;
}

body[data-theme="dark"] .comment.unread {
  border-color: #5eead4;
  background: color-mix(in srgb, #0f766e 28%, var(--panel));
  box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.16), 0 10px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .commentUnreadMark {
  background: #5eead4;
  color: #07111b;
}

body[data-theme="dark"] .commentEventUnreadMark {
  background: #fbbf24;
  color: #07111b;
}

body[data-theme="dark"] .commentNoticeDeleteBtn {
  background: color-mix(in srgb, var(--panel) 90%, #223148);
  color: var(--muted);
}

body[data-theme="dark"] .commentNoticeDeleteBtn:hover {
  border-color: #7f1d1d;
  background: #3b1116;
  color: #fda4af;
}

body[data-theme="dark"] .commentRevisionTag {
  border-color: #84581b;
  background: rgba(120, 83, 28, 0.32);
  color: #fcd34d;
}

body[data-theme="dark"] .commentComposer {
  border-color: #607086;
  background: color-mix(in srgb, var(--panel) 86%, #223148);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.commentNotice {
  position: relative;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid var(--chat-bubble-border);
  border-radius: 14px;
  background: var(--chat-status-bg);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.commentNotice.unreadStatus {
  border-color: #f2bd63;
  background: var(--chat-status-unread-bg);
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.storyboardHandoffNotice {
  display: grid;
  gap: 8px;
  margin: 8px 0 2px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(236, 253, 245, 0.94));
  color: var(--ink);
}

.storyboardHandoffTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1d4ed8;
  font-size: 14px;
}

.storyboardHandoffTitle::before {
  content: "→";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.storyboardHandoffNotice p {
  margin: 0;
  line-height: 1.45;
}

.storyboardHandoffLink {
  justify-self: start;
  color: #1d4ed8;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.storyboardHandoffLink:hover,
.storyboardHandoffLink:focus-visible {
  color: #1e40af;
}

.storyboardChatClosed {
  padding-top: 8px;
  border-top: 1px solid rgba(37, 99, 235, 0.18);
  color: var(--muted);
  font-size: 12px;
}

.commentNotice::before,
.commentNotice::after {
  content: none;
}

.commentNotice span {
  flex: 0 1 auto;
  text-align: center;
}

.commentMeta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
  font-size: 11px;
  line-height: 1.15;
  color: var(--muted);
}

.commentMeta strong {
  color: var(--ink);
  font-size: 12px;
}

.commentRevisionTag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border: 1px solid #f0d099;
  border-radius: 999px;
  background: #fff7ed;
  color: #8a4b0b;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
}

.commentBody {
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.36;
  white-space: pre-wrap;
}

.commentTranslationFlag {
  margin-top: 6px;
  color: var(--warn);
  font-size: 12px;
}

.commentMarkupPreviewWrap {
  position: relative;
  width: min(220px, 100%);
  margin-top: 8px;
}

.commentMarkupPreview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-top: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(24, 33, 47, 0.12);
}

.commentMarkupPreview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.commentMarkupPreview .commentMarkupOverlay {
  position: absolute;
  inset: 0;
}

.commentMarkupPreview span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #172033;
  font-size: 11px;
  font-weight: 700;
}

.revisionDownloadTrigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.commentRevisionDownloadBtn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  min-height: 24px;
  padding: 3px 8px;
  border-color: rgba(23, 32, 51, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #172033;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(24, 33, 47, 0.14);
}

.downloadGlyph {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.commentComposer {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 5px;
  margin-top: 0;
  padding: 4px 5px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--muted));
  border-radius: 12px;
  background: var(--control-bg);
  box-shadow: 0 1px 0 rgba(24, 33, 47, 0.04);
}

.commentComposer textarea {
  grid-column: 2;
  grid-row: 2;
  min-height: 32px;
  max-height: 180px;
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 6px 8px;
  background: transparent;
  color: var(--ink);
  resize: none;
  overflow: hidden;
  outline: none;
  line-height: 1.35;
}

.commentComposer textarea:focus {
  box-shadow: none;
}

.commentComposer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.commentComposerActions {
  display: contents;
}

.commentComposerActions button {
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
}

.attachCommentBtn {
  grid-column: 1;
  grid-row: 2;
}

.paperclipIcon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emojiCommentBtn {
  grid-column: 3;
  grid-row: 2;
}

.sendCommentBtn {
  grid-column: 4;
  grid-row: 2;
}

.sendIconBtn {
  font-weight: 800;
}

.commentAttachments {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 0;
}

.commentSendProgress {
  grid-column: 1 / -1;
  grid-row: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  padding: 2px 8px 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.commentSendProgress.hidden {
  display: none;
}

.commentComposer.isSending {
  cursor: wait;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.commentComposer.isSending textarea {
  opacity: 0.72;
}

.attachmentChip,
.commentAttachmentLink {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--soft-panel);
  font-size: 12px;
  text-decoration: none;
}

.attachmentChip.hasPreview,
.commentAttachmentPreview {
  border-radius: 10px;
  padding: 4px;
}

.attachmentChip.hasPreview img,
.commentAttachmentPreview img {
  display: block;
  width: 46px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--panel);
}

.commentAttachmentPreview {
  cursor: zoom-in;
}

.commentAttachmentPreview span {
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachmentChip button {
  min-width: 18px;
  min-height: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.commentAttachmentList {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.emojiMenu {
  position: absolute;
  right: 46px;
  bottom: 48px;
  z-index: 8;
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(24, 33, 47, 0.18);
}

.emojiMenu.hidden {
  display: none;
}

.commentEditBtn {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  padding: 0;
}

.commentEdited {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.commentComposer.editing {
  border-color: #0f766e;
  background: var(--panel);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.commentComposer.editing textarea {
  min-height: 32px;
}

.commentComposer button {
  justify-self: end;
}

.imageModal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  background: var(--modal-bg);
  color: var(--modal-ink);
}

.imageModal.hidden {
  display: none;
}

.modalTopbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 306px 8px 12px;
  border-bottom: 1px solid var(--modal-line);
  background: var(--modal-panel);
  background: color-mix(in srgb, var(--modal-panel) 96%, transparent);
}

.modalTopLeft {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modalLangSwitch {
  position: absolute;
  top: 9px;
  right: 12px;
  width: 126px;
  height: 34px;
  box-shadow: none;
}

.modalLangSwitch button {
  width: 42px;
  min-height: 32px;
  padding: 0;
  font-size: 12px;
}

.editorHistoryControls {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}

.iconToolBtn,
.modalCloseIcon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  border-color: var(--modal-line);
  background: var(--modal-panel);
  color: var(--modal-ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modalCloseIcon {
  position: fixed;
  top: 10px;
  right: 270px;
  z-index: 360;
  font-size: 25px;
  line-height: 1;
}

.imageStage > .modalCloseIcon {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 36;
  background: color-mix(in srgb, var(--modal-panel) 88%, transparent);
  backdrop-filter: blur(10px);
}

.modalTitleBlock h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  text-transform: none;
  color: var(--modal-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modalTitleBlock p {
  display: none;
}

.modalImageVersionSwitch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 0;
}

.modalImageVersionSwitch:empty {
  display: none;
}

.modalImageVersionSwitch .imageVersionBtn {
  box-shadow: none;
}

.imageVersionDeleteAction {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border-color: #fecdd3;
  background: #fff1f2;
  color: #b42318;
  font-size: 13px;
  font-weight: 800;
}

body[data-theme="dark"] .imageVersionDeleteAction {
  border-color: #7f1d1d;
  background: #3b1116;
  color: #fda4af;
}

.modalActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: none;
  overflow: visible;
  white-space: nowrap;
}

.modalActions button,
.compactControl {
  border-color: var(--modal-line);
  background: var(--modal-panel);
  color: var(--modal-ink);
}

.modalActions button {
  min-height: 34px;
  padding: 6px 9px;
}

.modalActions button:hover {
  border-color: rgba(255, 255, 255, 0.38);
}

.modalActions button.active,
.viewSwitch button.active {
  border-color: #5eead4;
  background: #0f766e;
  color: #fff;
}

.viewSwitch {
  flex: 0 0 auto;
  display: inline-flex;
  overflow: visible;
  border: 1px solid var(--modal-line);
  border-radius: 6px;
}

.viewSwitch button {
  border: 0;
  border-radius: 0;
}

.revisionLayerPicker {
  position: relative;
  display: inline-flex;
}

.modalDownloadPicker {
  display: inline-flex;
  align-items: stretch;
}

.modalRevisionDownloadBtn {
  min-width: 106px;
  white-space: nowrap;
}

.viewSwitch .modalRevisionDownloadBtn {
  border-left: 1px solid var(--modal-line);
}

.revisionLayerBtn {
  min-width: 112px;
}

.layoutGuideToggleBtn {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.layoutGuideToggleBtn.active {
  border-color: #5eead4;
  background: #0f766e;
  color: #ffffff;
}

.layoutGuideOpacityControl {
  display: inline-grid;
  grid-template-columns: minmax(52px, 82px) 34px;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 7px;
  border: 1px solid var(--modal-line);
  background: var(--modal-panel);
}

.layoutGuideOpacityControl.hidden {
  display: none;
}

.layoutGuideOpacityControl input {
  width: 100%;
  accent-color: #0f766e;
}

.layoutGuideOpacityControl output {
  color: var(--modal-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.revisionLayerMenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 420;
  display: grid;
  gap: 6px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(60vh, 520px);
  padding: 8px;
  border: 1px solid var(--modal-line);
  border-radius: 10px;
  background: var(--modal-panel);
  color: var(--modal-ink);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.22);
  overflow: auto;
}

.revisionLayerMenu.hidden {
  display: none;
}

.revisionLayerItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 1px solid var(--modal-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--modal-panel) 90%, var(--modal-stage));
  color: var(--modal-ink);
  text-align: left;
}

.revisionLayerOpen {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 54px;
  padding: 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.revisionLayerItem > .revisionLayerOpen:only-child {
  grid-column: 1 / -1;
}

.revisionLayerOpen:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, #ffffff);
  outline-offset: -3px;
}

.revisionLayerItem:hover {
  border-color: var(--accent);
}

.revisionLayerItem.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.revisionLayerItem.active .revisionLayerText strong {
  color: #ffffff;
}

.revisionLayerItem.active .revisionLayerText span {
  color: rgba(255, 255, 255, 0.78);
}

.revisionLayerItem.active .revisionLayerThumb {
  border-color: rgba(255, 255, 255, 0.72);
}

.revisionLayerThumb {
  position: relative;
  width: 56px;
  height: 40px;
  border: 1px solid var(--modal-line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.revisionLayerThumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.revisionLayerText {
  min-width: 0;
}

.revisionLayerText strong,
.revisionLayerText span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revisionLayerText span {
  margin-top: 2px;
  color: var(--modal-muted);
  font-size: 12px;
}

.revisionLayerDelete {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  margin-right: 7px;
  border-radius: 50%;
  color: #b91c1c;
}

.revisionLayerPosition {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  margin-right: 7px;
  border: 1px solid rgba(13, 148, 136, 0.34);
  border-radius: 6px;
  background: rgba(240, 253, 250, 0.92);
  color: #0f766e;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.revisionLayerPosition:hover,
.revisionLayerPosition:focus-visible {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.revisionLayerItem.active .revisionLayerDelete {
  background: rgba(255, 255, 255, 0.96);
  color: #b91c1c;
}

.revisionLayerItem.active .revisionLayerPosition {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.96);
  color: #0f766e;
}

body[data-theme="dark"] .revisionLayerItem.active {
  background: var(--accent);
  color: #0b1119;
}

body[data-theme="dark"] .revisionLayerItem.active .revisionLayerText strong {
  color: #0b1119;
}

body[data-theme="dark"] .revisionLayerItem.active .revisionLayerText span {
  color: rgba(11, 17, 25, 0.72);
}

body[data-theme="dark"] .revisionLayerItem.active .revisionLayerThumb {
  border-color: rgba(11, 17, 25, 0.28);
}

.compactControl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px;
  align-items: center;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--modal-line);
  border-radius: 6px;
}

.compactControl span {
  color: var(--modal-muted);
  font-size: 12px;
}

.compactControl input[type="color"] {
  width: 30px;
  height: 26px;
  min-height: 0;
  padding: 0;
}

.sizeControl input {
  width: 92px;
}

.modalLayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px minmax(320px, var(--modal-chat-width));
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.modalPanelResizeHandle {
  position: relative;
  z-index: 24;
  display: grid;
  place-items: center;
  min-width: 12px;
  border: 0;
  border-left: 1px solid var(--modal-line);
  border-right: 1px solid var(--modal-line);
  border-radius: 0;
  background: color-mix(in srgb, var(--modal-panel) 72%, transparent);
  cursor: col-resize;
}

.modalPanelResizeHandle::before {
  content: "";
  width: 3px;
  height: 46px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--modal-muted) 44%, transparent);
}

.modalPanelResizeHandle:hover,
.modalPanelResizeHandle:focus-visible,
body.resizingModalPanel .modalPanelResizeHandle {
  background: color-mix(in srgb, var(--accent) 16%, var(--modal-panel));
}

.modalPanelResizeHandle:hover::before,
.modalPanelResizeHandle:focus-visible::before,
body.resizingModalPanel .modalPanelResizeHandle::before {
  background: var(--accent);
}

.imageStage {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--modal-stage);
  cursor: crosshair;
}

.modalImageLoading {
  position: absolute;
  inset: 0;
  z-index: 100;
  align-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--modal-stage) 90%, transparent);
  color: var(--modal-muted);
  line-height: 1.35;
  text-align: center;
}

.modalImageLoading .loadingLabel {
  font-size: 14px;
  font-weight: 650;
}

.imageStage.isImageLoading > .modalCloseIcon {
  z-index: 101;
}

.imageStage.panMode {
  cursor: grab;
}

.imageStage.isPanning {
  cursor: grabbing;
}

.modalImageFrame {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  transform-origin: 0 0;
  line-height: 0;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  touch-action: none;
}

.modalImageFrame.hasLayoutTemplate {
  overflow: hidden;
  isolation: isolate;
}

.modalImageFrame.hasLayoutTemplate .layoutGuideLayer {
  z-index: 4;
}

.modalImageFrame.hasLayoutTemplate .publisherContentLayer {
  z-index: 3;
}

.modalArtworkLayer {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #fff;
}

.modalImageFrame.hasLayoutTemplate #modalImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.drawToolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 92;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100% - 28px);
  min-height: 49px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.88);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateX(-50%);
  transition: transform 180ms ease, opacity 160ms ease;
  backdrop-filter: blur(20px) saturate(1.12);
  -webkit-backdrop-filter: blur(20px) saturate(1.12);
  --tool-preview-color: #e11d48;
  --tool-size-percent: 13%;
  --tool-size-height: 7px;
}

.drawToolbarGroup {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.drawToolbarGroup + .drawToolbarGroup {
  padding-left: 6px;
  border-left: 1px solid rgba(148, 163, 184, 0.24);
}

.drawToolbarDock {
  position: absolute;
  left: 50%;
  bottom: 64px;
  z-index: 93;
  display: grid;
  width: 42px;
  height: 22px;
  min-width: 42px;
  min-height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px 999px 6px 6px;
  background: rgba(248, 250, 252, 0.9);
  color: #334155;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  transform: translateX(-50%);
  place-items: center;
  font-size: 16px;
  line-height: 1;
  transition: bottom 180ms ease, background-color 160ms ease;
}

.drawToolbarDock:hover,
.drawToolbarDock:focus-visible {
  background: #ffffff;
  color: #0f766e;
}

.imageStage.drawToolbarCollapsed .drawToolbar {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(100% + 18px));
}

.imageStage.drawToolbarCollapsed .drawToolbarDock {
  bottom: 4px;
}

.layoutPositionHud {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.9);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.layoutPositionHud.hidden {
  display: none;
}

.layoutScaleControl {
  display: grid;
  grid-template-columns: 54px 12px 140px;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.86);
}

.layoutScaleNumber {
  width: 54px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f766e;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: right;
}

.layoutScaleNumber:focus-visible {
  outline: 2px solid rgba(13, 148, 136, 0.46);
  outline-offset: 2px;
  border-radius: 3px;
}

.layoutScalePercent {
  color: #0f766e;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.layoutScaleControl input[type="range"] {
  width: 140px;
  margin: 0;
  accent-color: #0f766e;
}

.layoutHudIconBtn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 50%;
  background: rgba(241, 245, 249, 0.9);
  color: #334155;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.layoutHudIconBtn.primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.layoutFitBtn {
  font-size: 18px;
}

.layoutTransformBounds {
  position: absolute;
  z-index: 6;
  box-sizing: border-box;
  pointer-events: none;
  --layout-bound-left: 0%;
  --layout-bound-top: 0%;
  --layout-bound-width: 100%;
  --layout-bound-height: 100%;
}

.layoutTransformBounds::before {
  position: absolute;
  top: var(--layout-bound-top);
  left: var(--layout-bound-left);
  width: var(--layout-bound-width);
  height: var(--layout-bound-height);
  box-sizing: border-box;
  border: 1px solid rgba(13, 148, 136, 0.94);
  content: "";
}

.layoutTransformBounds.isClipped::before {
  border-style: dashed;
}

.layoutTransformBounds.hasNoVisibleArea::before {
  display: none;
}

.layoutTransformBounds.hidden {
  display: none;
}

.layoutTransformHandle {
  position: absolute;
  z-index: 1;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  border: 2px solid #0f766e;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  touch-action: none;
}

.layoutTransformHandle.nw {
  cursor: nwse-resize;
}

.layoutTransformHandle.ne {
  cursor: nesw-resize;
}

.layoutTransformHandle.se {
  cursor: nwse-resize;
}

.layoutTransformHandle.sw {
  cursor: nesw-resize;
}

.layoutTransformHandle.nw,
.layoutTransformHandle.ne,
.layoutTransformHandle.se,
.layoutTransformHandle.sw {
  transform: translate(-50%, -50%);
}

.layoutTransformHandle.docked {
  border-color: #0c4a6e;
  background: #ecfeff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92), 0 1px 5px rgba(15, 23, 42, 0.28);
}

.layoutTransformHandle:hover,
.layoutTransformHandle:focus-visible {
  border-color: #0f766e;
  background: #ccfbf1;
  outline: 0;
}

.imageStage.layoutPositionMode #drawingCanvas {
  cursor: grab;
}

.imageStage.isLayoutPositioning #drawingCanvas {
  cursor: grabbing;
}

.drawCircleBtn,
.drawTool,
.drawColorControl,
.drawSizeControl {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #111827;
}

.drawCircleBtn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  background: rgba(226, 232, 240, 0.82);
  color: rgba(15, 23, 42, 0.48);
  font-size: 17px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.drawCircleBtn:hover,
.drawCircleBtn:focus-visible {
  background: rgba(203, 213, 225, 0.95);
  color: #0f172a;
}

.drawTool {
  width: 31px;
  height: 38px;
  min-width: 31px;
  min-height: 38px;
  padding: 0;
  border-radius: 10px;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.drawTool:hover,
.drawTool:focus-visible {
  background: rgba(226, 232, 240, 0.62);
}

.drawTool.active {
  background: #0f172a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.toolGlyph {
  position: relative;
  display: block;
  width: 13px;
  height: 38px;
  border-radius: 999px;
  transform: scale(0.7);
  transform-origin: center center;
}

.toolGlyph::before,
.toolGlyph::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.penGlyph {
  width: 9px;
  border-radius: 999px 999px 5px 5px;
  background: linear-gradient(to bottom, #22c55e 0 20%, #f8fafc 20% 72%, #22c55e 72% 82%, #e5e7eb 82% 100%);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.26);
}

.penGlyph::before {
  top: -10px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 12px solid #22c55e;
}

.penGlyph::after {
  bottom: -7px;
  width: 3px;
  height: 8px;
  border-radius: 999px;
  background: #111827;
}

.markerGlyph {
  width: 15px;
  height: 40px;
  border-radius: 5px 5px 8px 8px;
  background: linear-gradient(to bottom, #ef233c 0 23%, #f8fafc 23% 66%, #ef233c 66% 78%, #e5e7eb 78% 100%);
}

.markerGlyph::before {
  top: -8px;
  width: 15px;
  height: 10px;
  border-radius: 5px 5px 1px 1px;
  background: linear-gradient(to bottom, #ef233c 0 70%, #991b1b 70% 100%);
}

.markerGlyph::after {
  bottom: -7px;
  width: 20px;
  height: 7px;
  border-radius: 2px 2px 999px 999px;
  background: #991b1b;
}

.eraserGlyph {
  width: 27px;
  height: 20px;
  border-radius: 7px;
  background: linear-gradient(135deg, #fb7185 0 46%, #f8fafc 46% 100%);
  box-shadow: inset 0 -4px 0 rgba(15, 23, 42, 0.12);
}

.eraserGlyph::after {
  bottom: -8px;
  width: 31px;
  height: 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.16);
}

.textGlyph {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: #111827;
  font-size: 21px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
}

.textGlyph::before {
  content: "Aa";
  position: static;
  display: block;
  transform: none;
}

.textGlyph::after {
  content: none;
}

.drawTool.active .toolGlyph {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.drawTool.active .textGlyph {
  color: #f8fafc;
}

.drawTool.active .eraserGlyph {
  background: linear-gradient(to bottom, #fff 0 42%, #dbeafe 42% 100%);
}

.drawColorControl {
  width: 31px;
  height: 31px;
  min-width: 31px;
  min-height: 31px;
  border-radius: 50%;
  cursor: pointer;
}

.drawColorControl input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.drawColorSwatch {
  width: 25px;
  height: 25px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--tool-preview-color);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12), 0 8px 18px rgba(15, 23, 42, 0.16);
}

.drawSizeControl {
  grid-template-columns: 22px 68px;
  gap: 5px;
  min-height: 31px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.drawSizePreview {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tool-preview-color) 0 calc(var(--tool-size-height) * 0.72), transparent calc(var(--tool-size-height) * 0.72 + 1px));
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.drawToolbar.textSizeMode .drawSizePreview {
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--tool-preview-color);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.drawSizeControl input[type="range"] {
  width: 68px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  accent-color: var(--tool-preview-color);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.drawSizeControl input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--tool-preview-color) 0 var(--tool-size-percent), rgba(203, 213, 225, 0.88) var(--tool-size-percent) 100%);
}

.drawSizeControl input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -5.5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--tool-preview-color);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16), 0 8px 18px rgba(15, 23, 42, 0.18);
  appearance: none;
  -webkit-appearance: none;
}

.drawSizeControl input[type="range"]::-moz-range-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(203, 213, 225, 0.88);
}

.drawSizeControl input[type="range"]::-moz-range-progress {
  height: 7px;
  border-radius: 999px;
  background: var(--tool-preview-color);
}

.drawSizeControl input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--tool-preview-color);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16), 0 8px 18px rgba(15, 23, 42, 0.18);
}

.drawCircleBtn:disabled {
  opacity: 0.42;
  cursor: default;
}

.drawCircleBtn:disabled:hover {
  background: rgba(226, 232, 240, 0.82);
  color: rgba(15, 23, 42, 0.48);
}

body[data-theme="dark"] .drawToolbar {
  border-color: rgba(226, 232, 240, 0.16);
  background: rgba(27, 39, 55, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .drawToolbarGroup + .drawToolbarGroup {
  border-left-color: rgba(226, 232, 240, 0.12);
}

body[data-theme="dark"] .drawCircleBtn,
body[data-theme="dark"] .drawSizeControl {
  background: rgba(51, 65, 85, 0.78);
  color: rgba(226, 232, 240, 0.68);
}

body[data-theme="dark"] .drawCircleBtn:hover,
body[data-theme="dark"] .drawCircleBtn:focus-visible {
  background: rgba(71, 85, 105, 0.92);
  color: #f8fafc;
}

body[data-theme="dark"] .drawCircleBtn:disabled:hover {
  background: rgba(51, 65, 85, 0.78);
  color: rgba(226, 232, 240, 0.68);
}

body[data-theme="dark"] .drawTool:hover,
body[data-theme="dark"] .drawTool:focus-visible {
  background: rgba(51, 65, 85, 0.72);
}

body[data-theme="dark"] .drawTool.active {
  background: #f8fafc;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

body[data-theme="dark"] .drawTool.active .toolGlyph {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.24));
}

body[data-theme="dark"] .drawTool.active .textGlyph {
  color: #111827;
}

body[data-theme="dark"] .drawColorSwatch {
  border-color: #1e293b;
  box-shadow: 0 0 0 2px rgba(226, 232, 240, 0.18), 0 10px 22px rgba(0, 0, 0, 0.26);
}

.modalImageFrame.before #drawingCanvas {
  opacity: 0;
  pointer-events: none;
}

.modalImageFrame.before .textNotesLayer {
  opacity: 0;
  pointer-events: none;
}

#modalImage {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

#modalImage.crispDrawingImage {
  image-rendering: crisp-edges;
}

#drawingCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 2;
}

#drawingCanvas:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.textNotesLayer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.textNote {
  position: absolute;
  min-width: 80px;
  min-height: 34px;
  border: 1px solid rgba(13, 148, 136, 0.8);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 8px 22px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
  line-height: 1.18;
}

.textNote.active {
  border-color: #0f766e;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.28), 0 12px 30px rgba(15, 23, 42, 0.24);
}

.textNoteBody {
  min-width: 100%;
  min-height: 100%;
  padding: 6px 22px 6px 8px;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.88), 0 -1px 0 rgba(255, 255, 255, 0.88), 1px 0 0 rgba(255, 255, 255, 0.88), -1px 0 0 rgba(255, 255, 255, 0.88);
}

.textNoteMoveHandle,
.textNoteResizeHandle,
.textNoteDeleteBtn {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: #0f766e;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(13, 148, 136, 0.45);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.textNoteMoveHandle {
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  cursor: move;
  line-height: 1;
}

.textNoteMoveHandle::before,
.textNoteMoveHandle::after {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #0f766e;
  font-size: 13px;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.textNoteMoveHandle::before {
  content: "↕";
}

.textNoteMoveHandle::after {
  content: "↔";
}

.textNoteDeleteBtn {
  top: -10px;
  left: -10px;
  width: 22px;
  height: 22px;
  border-color: rgba(190, 24, 93, 0.42);
  border-radius: 50%;
  color: #be185d;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.textNoteDeleteBtn:hover,
.textNoteDeleteBtn:focus-visible {
  background: #be185d;
  color: #ffffff;
}

.textNoteResizeHandle {
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  border-radius: 4px;
  cursor: nwse-resize;
}

.imageStage.showBrushCursor #drawingCanvas {
  cursor: none;
}

.brushCursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  width: var(--brush-cursor-size, 18px);
  height: var(--brush-cursor-size, 18px);
  border: 2px solid var(--brush-cursor-color, #e11d48);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.88), 0 2px 8px rgba(0, 0, 0, 0.24);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.brushCursor.hidden {
  display: none;
}

.floatingSendDrawingBtn {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 94;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  min-width: 88px;
  min-height: 88px;
  padding: 0;
  border-radius: 50%;
  border-color: var(--modal-line);
  background: #d7dee8;
  color: #708090;
  font-size: 34px;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  will-change: left, top;
}

.floatingSendDrawingBtn.ready {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.floatingSendDrawingBtn.isSending {
  color: transparent;
  cursor: wait;
}

.floatingSendDrawingBtn.isSending::after {
  content: "";
  width: 30px;
  height: 30px;
  border: 4px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: imageLoadingSpinnerTurn 0.8s linear infinite;
}

.floatingSendDrawingBtn:disabled {
  cursor: default;
}

.imageStage.panMode #drawingCanvas {
  cursor: grab;
}

.imageStage.isPanning #drawingCanvas {
  cursor: grabbing;
}

.inlineTextEditor {
  position: absolute;
  z-index: 5;
  min-width: 160px;
  min-height: 38px;
  padding: 6px 8px;
  border: 2px solid #5eead4;
  border-radius: 4px;
  outline: none;
  resize: both;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  line-height: 1.2;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.inlineTextEditor.hidden {
  display: none;
}

.revisionPanel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  background: var(--modal-panel);
  color: var(--modal-ink);
  overflow: hidden;
}

#modalMessage {
  position: relative;
  grid-row: 1;
  z-index: 1;
  min-height: 0;
  max-height: 64px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--modal-line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 8%, var(--modal-panel));
  color: var(--modal-muted);
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  pointer-events: none;
}

#modalMessage:empty {
  display: none;
}

#modalMessage.good {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--modal-line));
  background: color-mix(in srgb, var(--accent) 8%, var(--modal-panel));
  color: var(--modal-muted);
}

#modalMessage.error {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--modal-line));
  background: color-mix(in srgb, var(--danger) 9%, var(--modal-panel));
  color: var(--danger);
}

.modalChatHost {
  grid-row: 2;
  display: grid;
  min-height: 0;
}

.modalChatHost .commentThread {
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  border: 0;
}

.modalChatHost .commentsHeader {
  display: none;
}

.modalChatHost .comments {
  height: 100%;
  max-height: none;
}

.modalChatHost .commentComposer {
  margin-top: 0;
}

.revisionPanel > h3,
#revisionHint,
#markupRevisionMeta,
#revisionListToggle,
#revisionList {
  display: none;
}

.revisionPanel h3 {
  margin-bottom: 8px;
}

.revisionPanel .field span,
#revisionHint {
  color: var(--modal-muted);
}

.revisionPanel textarea {
  border-color: var(--modal-line);
  background: var(--control-bg);
  color: var(--ink);
}

.revisionPanel .commentComposer textarea {
  border-color: transparent;
  background: transparent;
  color: var(--modal-ink);
}

.revisionPanel .commentComposer {
  border-color: var(--modal-line);
  background: color-mix(in srgb, var(--modal-panel) 88%, var(--modal-stage));
}

.revisionMeta {
  min-height: 18px;
  margin-top: 8px;
  color: var(--modal-muted);
  font-size: 12px;
}

.saveRevisionBtn {
  width: 100%;
  margin-top: 10px;
}

.revisionList {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.revisionList.collapsed {
  display: none;
}

.revisionListToggle {
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  border-color: var(--modal-line);
  background: var(--modal-panel);
  color: var(--modal-ink);
  text-align: left;
  font-weight: 700;
}

.revisionListToggle::before {
  content: "▸";
  display: inline-block;
  width: 18px;
  color: var(--modal-muted);
}

.revisionListToggle[aria-expanded="true"]::before {
  content: "▾";
}

.revisionItem {
  width: 100%;
  padding: 9px;
  text-align: left;
  border-color: var(--modal-line);
  background: var(--soft-panel);
  color: var(--ink);
}

.revisionItem strong,
.revisionItem span {
  display: block;
}

.revisionItem span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.siteContextMenu {
  position: fixed;
  z-index: 700;
  display: grid;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(24, 33, 47, 0.24);
}

.siteContextMenu.hidden {
  display: none;
}

.siteContextMenu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.siteContextMenu button:hover {
  background: var(--soft-panel);
}

.siteContextMenu button.danger {
  color: #b42318;
}

body[data-theme="dark"] .siteContextMenu button.danger {
  color: #ff9aa8;
}

.revisionDownloadMenu {
  position: fixed;
  z-index: 760;
  display: grid;
  width: min(340px, calc(100vw - 16px));
  max-height: min(430px, calc(100vh - 16px));
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 54px rgba(24, 33, 47, 0.28);
}

.revisionDownloadMenu.hidden {
  display: none;
}

.revisionDownloadHeading {
  padding: 7px 9px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.revisionDownloadOption {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: start;
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.revisionDownloadOption:hover,
.revisionDownloadOption:focus-visible {
  background: var(--soft-panel);
}

.revisionDownloadOption strong,
.revisionDownloadOption span {
  display: block;
  min-width: 0;
  max-width: 100%;
}

.revisionDownloadOption strong {
  font-size: 13px;
}

.revisionDownloadOption span {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.revisionDownloadOption:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.confirmOverlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 23, 34, 0.58);
}

.confirmDialog {
  width: min(460px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.confirmDialog h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 18px;
  text-transform: none;
}

.confirmDialog p {
  color: var(--muted);
}

.confirmActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.dangerAction {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

body[data-theme="dark"] .dangerAction {
  border-color: #ff8a98;
  background: #ff8a98;
  color: #151f2c;
}

.attachmentPreviewOverlay {
  position: fixed;
  inset: 0;
  z-index: 530;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(16, 23, 34, 0.74);
}

.attachmentPreviewDialog {
  position: relative;
  display: grid;
  gap: 10px;
  width: min(96vw, 1400px);
  max-height: 96vh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.attachmentPreviewStage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(68vh, 720px);
  overflow: hidden;
  border-radius: 6px;
  background: var(--soft-panel);
  touch-action: pan-y pinch-zoom;
}

.attachmentPreviewStage img {
  display: block;
  width: 100%;
  max-height: calc(96vh - 84px);
  object-fit: contain;
  border-radius: 6px;
}

.attachmentPreviewDialog .modalCloseIcon {
  position: absolute;
  z-index: 4;
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
}

.attachmentPreviewNav {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 54px;
  height: 68px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
}

.attachmentPreviewNav:hover:not(:disabled),
.attachmentPreviewNav:focus-visible {
  border-color: var(--accent);
  background: var(--panel);
}

.attachmentPreviewNav:disabled {
  opacity: 0.28;
  cursor: default;
}

.attachmentPreviewPrevious {
  left: 18px;
}

.attachmentPreviewNext {
  right: 18px;
}

.attachmentPreviewLoading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  place-items: center;
  background: color-mix(in srgb, var(--soft-panel) 76%, transparent);
  pointer-events: none;
}

.attachmentPreviewOverlay.isLoading .attachmentPreviewLoading {
  display: grid;
}

.attachmentPreviewFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.attachmentPreviewCaption {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-word;
}

.attachmentPreviewCounter {
  flex: 0 0 auto;
  min-width: 54px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 600px) {
  .attachmentPreviewOverlay {
    padding: 0;
  }

  .attachmentPreviewDialog {
    width: 100vw;
    max-height: 100dvh;
    min-height: 100dvh;
    padding: 8px;
    border: 0;
    border-radius: 0;
  }

  .attachmentPreviewStage {
    min-height: 0;
    height: calc(100dvh - 54px);
  }

  .attachmentPreviewStage img {
    max-height: calc(100dvh - 54px);
  }

  .attachmentPreviewDialog .modalCloseIcon {
    top: 14px;
    right: 14px;
  }

  .attachmentPreviewNav {
    width: 46px;
    height: 60px;
    font-size: 36px;
  }

  .attachmentPreviewPrevious {
    left: 10px;
  }

  .attachmentPreviewNext {
    right: 10px;
  }
}

@media (max-width: 1240px) {
  .topbar {
    padding-left: 12px;
  }

  .brandLine h1 {
    display: none;
  }

  .card,
  body[data-role="client"] .card {
    grid-template-columns: 1fr;
  }

  .storyImage {
    width: auto;
    max-height: min(72vh, 780px);
  }

}

@media (min-width: 761px) and (max-width: 1240px) {
  .card:not(.contactSheetCard):not(.originalTextCard) .imagePane,
  .card:not(.contactSheetCard):not(.originalTextCard) .editPane {
    height: auto;
    overflow: visible;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .commentThread {
    height: auto;
    min-height: 0;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .comments {
    height: auto;
    max-height: min(48vh, 440px);
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .comments::before {
    display: none;
  }
}

@media (max-width: 1120px) {
  .modalTopbar {
    padding-right: 12px;
    padding-top: 58px;
  }

  .modalCloseIcon {
    top: 58px;
    right: 12px;
  }

  .modalLayout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(240px, 34vh);
  }

  .modalPanelResizeHandle {
    display: none;
  }

  .revisionPanel {
    border-left: 0;
    border-top: 1px solid var(--modal-line);
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-sticky-offset: 104px;
  }

  body {
    font-size: 13px;
  }

  .topRightControls {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
    justify-content: flex-end;
  }

  .globalLangSwitch {
    width: 126px;
    height: 34px;
  }

  .globalLangSwitch button {
    width: 42px;
    min-height: 32px;
    font-size: 12px;
  }

  .themeToggleBtn,
  .accountBtn {
    width: 34px;
    height: 34px;
  }

  .topbar {
    min-height: 104px;
    padding: 54px 8px 8px;
    align-items: end;
  }

  .brandLine {
    justify-content: flex-start;
    width: 100%;
  }

  .sectionSwitch {
    width: 100%;
    justify-content: flex-start;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sectionSwitch::-webkit-scrollbar {
    display: none;
  }

  .sectionSwitch button {
    flex: 0 0 auto;
    max-width: min(58vw, 220px);
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    scroll-snap-align: start;
  }

  .layout {
    padding: 10px;
  }

  .toolbarMessage,
  .contactToolbar {
    width: calc(100% - 20px);
  }

  .contactToolbar {
    justify-content: center;
    gap: 6px;
  }

  .contactToolbarGroup,
  .contactToolbarGroup button,
  .compactLightControl {
    width: auto;
  }

  .contactToolbar {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .contactToolbarActions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    margin-left: 0;
  }

  .contactToolbarGroup {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .contactToolbarGroup button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .gridStepControl,
  .gridToolbarLabel {
    width: auto;
  }

  .gridStepControl {
    flex: 1 1 auto;
  }

  .gridStepControl button {
    flex: 1 1 0;
    width: auto;
  }

  .card {
    gap: 12px;
    padding: 10px;
  }

  .card.contactSheetCard {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .cards.contactSheetGrid {
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    gap: 10px;
  }

  .card.contactSheetCard .imagePane,
  .contactNavMeta {
    min-width: 0;
    overflow: hidden;
  }

  .contactNavTitleRow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px;
    align-items: center;
    gap: 2px;
    min-height: 24px;
    height: 24px;
  }

  .contactNavTitle {
    font-size: 11px;
    line-height: 14px;
  }

  .contactNavStatusTarget {
    width: 20px;
    height: 20px;
  }

  .cardTitle {
    font-size: 16px;
  }

  .cardTopLine {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .statusInline {
    white-space: normal;
  }

  .statusSelect {
    max-width: 100%;
  }

  .imageWrap {
    min-height: 180px;
  }

  .card:not(.contactSheetCard):not(.originalTextCard) .imageWrap {
    height: min(64vh, 430px);
  }

  .storyImage {
    max-height: 68vh;
  }

  .layoutPositionHud {
    top: 10px;
    max-width: calc(100% - 18px);
  }

  .layoutScaleControl {
    grid-template-columns: 46px 10px minmax(86px, 112px);
    gap: 4px;
  }

  .layoutScaleNumber {
    width: 46px;
  }

  .layoutScaleControl input[type="range"] {
    width: min(112px, 25vw);
  }

  .layoutHudIconBtn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }

  .layoutTransformHandle {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
  }

  .comments {
    max-height: 360px;
    padding-right: 0;
  }

  .comment {
    max-width: 94%;
    font-size: 14px;
  }

  .commentBody {
    font-size: 14.5px;
  }

  .commentComposerActions {
    justify-content: space-between;
  }

  .loginOverlay {
    padding: 10px;
  }

  .loginArtwork {
    min-height: 210px;
  }

  .loginHeroImage {
    min-height: 210px;
  }

  .loginBox {
    padding: 20px;
  }

  .loginIntro h1 {
    font-size: 26px;
  }

  .loginLangSwitch {
    width: 100%;
  }

  .loginLangSwitch button {
    flex: 1 1 0;
    min-width: 0;
  }

  .modalTopbar {
    min-height: 108px;
    padding: 54px 58px 8px 8px;
  }

  .modalLangSwitch {
    top: 10px;
    right: 10px;
    width: 102px;
    height: 32px;
  }

  .modalLangSwitch button {
    width: 34px;
    min-height: 30px;
    font-size: 11px;
  }

  .modalTopLeft {
    width: 100%;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .modalTitleBlock {
    flex: 1 1 100%;
    min-width: 0;
  }

  .modalTitleBlock h2 {
    font-size: 18px;
    white-space: normal;
  }

  .modalCloseIcon {
    top: 58px;
    right: 10px;
  }

  .viewSwitch button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .viewSwitch {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .layoutGuideOpacityControl {
    grid-template-columns: minmax(44px, 60px) 30px;
  }

  .modalLayout {
    grid-template-rows: minmax(0, 1fr) minmax(250px, 38vh);
  }

  .drawToolbar {
    bottom: 12px;
    justify-content: flex-start;
    max-width: calc(100% - 16px);
    min-height: 49px;
    padding: 4px 7px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    border-radius: 38px;
    scrollbar-width: none;
  }

  .drawToolbar::-webkit-scrollbar {
    display: none;
  }

  .drawToolbarGroup {
    gap: 4px;
  }

  .drawToolbarGroup + .drawToolbarGroup {
    padding-left: 6px;
  }

  .drawCircleBtn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    font-size: 17px;
  }

  .drawTool {
    width: 31px;
    height: 38px;
    min-width: 31px;
    min-height: 38px;
    border-radius: 10px;
  }

  .toolGlyph {
    height: 38px;
    transform: scale(0.7);
  }

  .drawColorControl {
    width: 31px;
    height: 31px;
    min-width: 31px;
    min-height: 31px;
  }

  .drawColorSwatch {
    width: 25px;
    height: 25px;
  }

  .drawSizeControl {
    grid-template-columns: 22px 68px;
    min-height: 31px;
    gap: 5px;
    padding: 3px 6px;
  }

  .drawSizePreview {
    width: 20px;
    height: 20px;
  }

  .drawSizeControl input[type="range"] {
    width: 68px;
  }

  .drawToolbar button,
  .drawToolbar label {
    flex: 0 0 auto;
  }

  .revisionPanel {
    padding: 10px;
  }

  .confirmActions button {
    flex: 1 1 100%;
  }
}

@media (max-width: 980px) {
  .loginOverlay {
    align-items: start;
    padding: 14px;
  }

  .loginShell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .loginArtwork {
    min-height: 260px;
  }

  .loginHeroImage {
    min-height: 260px;
    object-position: 58% center;
  }

  .loginSketchStrip {
    display: none;
  }

  .loginArtworkCaption strong {
    font-size: 24px;
  }

  .loginBox {
    padding: 24px;
  }

  .topbar,
  .brandLine,
  .layout,
  .card,
  .commentTop {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .brandLine {
    display: flex;
    flex-wrap: wrap;
  }

  .cardTopLine {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .layout {
    display: grid;
  }

  .revisionPanel {
    border-left: 0;
    border-top: 1px solid var(--modal-line);
  }
}

body[data-theme="dark"] .topbar {
  border-bottom-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .contactToolbar,
body[data-theme="dark"] .toolbarMessage {
  border-color: rgba(148, 163, 184, 0.18);
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .card.contactSheetCard {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body[data-theme="dark"] .sectionSwitch,
body[data-theme="dark"] .langSwitch,
body[data-theme="dark"] .gridStepControl {
  border-color: rgba(148, 163, 184, 0.2);
  background: #172233;
}

body[data-theme="dark"] button:hover {
  border-color: rgba(167, 220, 255, 0.72);
}

body[data-theme="dark"] .gridStepControl button.active {
  background: var(--accent);
  color: #07111b;
}

body[data-theme="dark"] .accountBtn {
  border-color: rgba(167, 220, 255, 0.32);
  background: #24344a;
  color: #edf4ff;
}

body[data-theme="dark"] .comments {
  border-color: rgba(148, 163, 184, 0.18);
  background: var(--chat-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

body[data-theme="dark"] .comment.left,
body[data-theme="dark"] .comment.right {
  border-color: transparent;
  color: #edf4ff;
  box-shadow: none;
}

body[data-theme="dark"] .comment.left {
  background: var(--chat-bubble-left);
}

body[data-theme="dark"] .comment.right {
  background: var(--chat-bubble-right);
}

body[data-theme="dark"] .comment.unread {
  border-color: transparent;
  background: #2b3f58;
  box-shadow: 0 0 0 2px rgba(124, 199, 255, 0.14), 0 10px 28px rgba(0, 0, 0, 0.24);
}

body[data-theme="dark"] .comment.unread.reading {
  box-shadow: 0 0 0 2px rgba(124, 199, 255, 0.24), 0 12px 30px rgba(0, 0, 0, 0.26);
}

body[data-theme="dark"] .commentNotice {
  border-color: transparent;
  background: var(--chat-status-bg);
  color: #b9c6d9;
}

body[data-theme="dark"] .commentNotice.unreadStatus {
  border-color: transparent;
  background: var(--chat-status-unread-bg);
  color: #edf4ff;
  box-shadow: 0 0 0 1px rgba(246, 198, 109, 0.18);
}

body[data-theme="dark"] .storyboardHandoffNotice {
  border-color: rgba(96, 165, 250, 0.28);
  background: linear-gradient(135deg, rgba(23, 37, 84, 0.86), rgba(6, 78, 59, 0.62));
}

body[data-theme="dark"] .storyboardHandoffTitle,
body[data-theme="dark"] .storyboardHandoffLink {
  color: #bfdbfe;
}

body[data-theme="dark"] .storyboardHandoffLink:hover,
body[data-theme="dark"] .storyboardHandoffLink:focus-visible {
  color: #dbeafe;
}

body[data-theme="dark"] .storyboardChatClosed {
  border-top-color: rgba(147, 197, 253, 0.2);
  color: #b9c6d9;
}

body[data-theme="dark"] .commentUnreadMark {
  background: var(--accent);
  color: #07111b;
}

body[data-theme="dark"] .commentEventUnreadMark {
  background: var(--warn);
  color: #1e293b;
}

body[data-theme="dark"] .commentComposer {
  border-color: rgba(148, 163, 184, 0.2);
  background: var(--chat-input-bg);
  box-shadow: none;
}

body[data-theme="dark"] .commentComposer:focus-within {
  border-color: rgba(124, 199, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(124, 199, 255, 0.14);
}

body[data-theme="dark"] .commentComposer textarea::placeholder {
  color: #7f8da1;
}

body[data-theme="dark"] .commentMarkupPreview,
body[data-theme="dark"] .attachmentChip,
body[data-theme="dark"] .commentAttachmentLink,
body[data-theme="dark"] .emojiMenu,
body[data-theme="dark"] .siteContextMenu,
body[data-theme="dark"] .revisionDownloadMenu,
body[data-theme="dark"] .accountMenu {
  border-color: rgba(148, 163, 184, 0.18);
  background: #1b2737;
  color: #edf4ff;
}

body[data-theme="dark"] .commentRevisionDownloadBtn {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(22, 31, 45, 0.94);
  color: #edf4ff;
}

body[data-theme="dark"] .card.contactSheetCard .selectCheck {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(22, 31, 45, 0.9);
  color: #edf4ff;
}

body[data-theme="dark"] .card.contactSheetCard .imageWrap {
  background: #152030;
}

body[data-theme="dark"] .contactNavTitle {
  color: #edf4ff;
}

body[data-theme="dark"] .contactNavStatus {
  box-shadow: none;
}

body[data-theme="dark"] .contactNavStatus.statusColor-draft {
  background: #94a3b8;
}

body[data-theme="dark"] .contactNavStatus.statusColor-waiting_revision {
  background: #fbbf24;
}

body[data-theme="dark"] .contactNavStatus.statusColor-accepted_editing,
body[data-theme="dark"] .contactNavStatus.statusColor-approved {
  background: #4ade80;
}

body[data-theme="dark"] .contactNavStatus.statusColor-moved_to_spreads {
  background: #60a5fa;
}

body[data-theme="dark"] .contactNavStatus.statusColor-rejected_discuss {
  background: #f87171;
}

body[data-theme="dark"] .statusColor-waiting_revision {
  background: rgba(246, 198, 109, 0.16);
  color: #ffd88a;
}

body[data-theme="dark"] .statusColor-draft {
  background: rgba(148, 163, 184, 0.16);
  color: #c7d2e2;
}

body[data-theme="dark"] .imageVersionSwitch,
body[data-theme="dark"] .imageWrap .cardStatusInline,
body[data-theme="dark"] .openImageBtn {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(20, 30, 44, 0.86);
  color: #edf4ff;
}

body[data-theme="dark"] .markupSummary {
  border-left-color: var(--accent);
  background: rgba(124, 199, 255, 0.08);
  color: #dce8f7;
}

body[data-theme="dark"] .message.good {
  color: var(--accent-dark);
}

/* Mobile usability and safe-area pass. Keep controls tappable without sacrificing
   the artwork viewport in the drawing modal. */
@media (max-width: 760px) {
  :root {
    --topbar-sticky-offset: calc(116px + env(safe-area-inset-top));
  }

  .topRightControls {
    top: max(8px, env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
  }

  .globalLangSwitch {
    width: 132px;
    height: 44px;
  }

  .globalLangSwitch button {
    width: 44px;
    min-height: 44px;
  }

  .themeToggleBtn,
  .accountBtn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .topbar {
    min-height: calc(116px + env(safe-area-inset-top));
    padding: calc(64px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 8px calc(8px + env(safe-area-inset-left));
  }

  .sectionSwitch button {
    min-height: 44px;
  }

  .gridToolbarGroup {
    display: none;
  }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px;
  }

  .statusSelect,
  .imageWrap .statusSelect {
    min-height: 44px;
    font-size: 16px;
  }

  .commentComposer textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .commentComposerActions button,
  .commentAttachmentPreview,
  .openImageBtn,
  .confirmActions button {
    min-width: 44px;
    min-height: 44px;
  }

  .modalTopbar {
    min-height: calc(116px + env(safe-area-inset-top));
    padding: calc(64px + env(safe-area-inset-top)) calc(58px + env(safe-area-inset-right)) 8px calc(8px + env(safe-area-inset-left));
    overflow: hidden;
  }

  .modalLangSwitch {
    top: max(10px, env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
    width: 120px;
    height: 44px;
  }

  .modalLangSwitch button {
    width: 40px;
    min-height: 44px;
    font-size: 12px;
  }

  .modalTopLeft {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .modalTopLeft::-webkit-scrollbar {
    display: none;
  }

  .modalTitleBlock {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .viewSwitch {
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }

  .viewSwitch button,
  .revisionLayerBtn,
  .layoutGuideToggleBtn,
  .imageVersionBtn,
  .imageVersionDeleteAction {
    min-height: 44px;
  }

  .imageStage > .modalCloseIcon {
    top: calc(10px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
  }

  .modalCloseIcon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .modalLayout {
    grid-template-rows: minmax(120px, 1fr) minmax(220px, 38vh);
  }

  .revisionPanel {
    min-height: 0;
    padding: 8px;
  }

  .drawToolbar {
    bottom: calc(12px + env(safe-area-inset-bottom));
    min-height: 54px;
  }

  .drawCircleBtn,
  .drawTool,
  .drawColorControl {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .drawSizeControl {
    min-height: 44px;
  }

  .drawToolbarDock {
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: 44px;
    min-width: 44px;
    height: 32px;
    min-height: 32px;
  }

  .imageStage.drawToolbarCollapsed .drawToolbarDock {
    bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .floatingSendDrawingBtn {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
  }

  .layoutPositionHud {
    left: max(9px, env(safe-area-inset-left));
    right: max(9px, env(safe-area-inset-right));
    max-width: none;
    overflow-x: auto;
    transform: none;
  }

  .layoutHudIconBtn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .layoutTransformHandle {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
  }

  .attachmentPreviewDialog {
    padding:
      calc(8px + env(safe-area-inset-top))
      calc(8px + env(safe-area-inset-right))
      calc(8px + env(safe-area-inset-bottom))
      calc(8px + env(safe-area-inset-left));
  }

  .attachmentPreviewDialog .modalCloseIcon {
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
  }
}

@media (hover: none) and (pointer: coarse) {
  input[type="text"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px;
  }
}

@media (max-height: 600px) and (orientation: landscape) and (max-width: 1120px) {
  .gridToolbarGroup {
    display: none;
  }

  .modalTopbar {
    min-height: calc(56px + env(safe-area-inset-top));
    max-height: calc(56px + env(safe-area-inset-top));
    padding: calc(6px + env(safe-area-inset-top)) calc(118px + env(safe-area-inset-right)) 6px calc(6px + env(safe-area-inset-left));
    overflow: hidden;
  }

  .modalTopLeft {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .modalTopLeft::-webkit-scrollbar {
    display: none;
  }

  .modalTitleBlock {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .viewSwitch {
    flex-wrap: nowrap;
  }

  .viewSwitch button,
  .revisionLayerBtn,
  .layoutGuideToggleBtn,
  .imageVersionBtn,
  .imageVersionDeleteAction {
    min-height: 44px;
  }

  .modalLangSwitch {
    top: calc(6px + env(safe-area-inset-top));
    right: calc(6px + env(safe-area-inset-right));
    width: 108px;
    height: 44px;
  }

  .modalLangSwitch button {
    width: 36px;
    min-height: 44px;
  }

  .modalLayout {
    grid-template-rows: minmax(120px, 1fr) minmax(104px, 34vh);
  }

  .revisionPanel {
    min-height: 0;
    padding: 6px;
  }

  .revisionPanel .comments {
    padding: 6px;
  }

  .commentComposer textarea {
    min-height: 40px;
    font-size: 16px;
  }

  .commentComposerActions button {
    min-width: 40px;
    min-height: 40px;
  }

  .imageStage > .modalCloseIcon {
    top: calc(6px + env(safe-area-inset-top));
    right: calc(6px + env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .drawToolbar {
    bottom: calc(6px + env(safe-area-inset-bottom));
    min-height: 48px;
    max-width: calc(100% - 12px - env(safe-area-inset-left) - env(safe-area-inset-right));
  }

  .drawToolbarDock {
    bottom: calc(58px + env(safe-area-inset-bottom));
  }

  .floatingSendDrawingBtn {
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
    font-size: 26px;
  }
}
