* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Arial, Helvetica, sans-serif;
  background: #eef2f7;
  color: #0f172a;
}
button, input, select, textarea {
  font: inherit;
}
button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}
button:hover { background: #f8fafc; }
button.primary {
  background: #0d47a1;
  border-color: #0d47a1;
  color: #fff;
}
button.primary:hover { background: #0b3f8d; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
}
textarea { resize: vertical; }

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}
.sidebar {
  width: 258px;
  background: linear-gradient(180deg, #12233f 0%, #0f172a 100%);
  color: #e2e8f0;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.brand {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,.06);
}
.brand-logo {
  width: 103px;
  height: 103px;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  padding: 9px;
}
.brand-text {
  display: flex;
  flex: 1 1 auto;
  min-height: 95px;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: flex-start;
  color: #ffffff;
}
.brand-text span {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-align: left;
}
.tool-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.sidebar-object-card {
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px 7px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.sidebar-object-grid {
  display: grid;
  grid-template-columns: repeat(3, 66px);
  justify-content: center;
  gap: 8px;
}
.sidebar-object-btn {
  width: 66px;
  min-width: 66px;
  max-width: 66px;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 5px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 7px;
  font-weight: 700;
  text-align: center;
}
.sidebar-object-btn.sidebar-object-btn-select {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
}
.sidebar-object-btn.sidebar-object-btn-select:hover,
.sidebar-object-btn.sidebar-object-btn-select:focus-visible {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}
.sidebar-object-btn:hover,
.sidebar-object-btn:focus-visible {
  border-color: #93c5fd;
  background: #f8fbff;
  color: #1d4ed8;
}
.sidebar-object-btn .toolbar-icon,
.sidebar-object-btn .toolbar-icon-lg {
  width: 28px;
  height: 28px;
}
.sidebar-object-btn span {
  line-height: 1;
  white-space: nowrap;
  font-size: 9.8px;
  letter-spacing: 0;
}
.sidebar-object-btn.active {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}
.sidebar-object-btn.sidebar-object-btn-select.active {
  border-color: #fb7185;
  box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.4);
}
.sidebar-object-title {
  margin-top: 8px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
}
.tool-btn,
.template-btn {
  width: 100%;
  text-align: left;
  color: #e2e8f0;
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
  font-size: 11px;
  min-height: 35px;
  padding: 8px 11px;
  border-radius: 12px;
}
.tool-btn.active {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #fff;
}
.tool-btn-shapes {
  position: relative;
}
.tool-btn-shapes::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-62%) rotate(-45deg);
  opacity: 0.7;
}
.shape-flyout {
  position: absolute;
  z-index: 80;
  width: 470px;
  max-height: min(78vh, 860px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow:
    0 26px 60px rgba(15,23,42,0.22),
    0 10px 24px rgba(15,23,42,0.14);
  backdrop-filter: blur(10px);
}
.shape-flyout[hidden] {
  display: none !important;
}
.shape-flyout::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 30px;
  width: 24px;
  height: 24px;
  transform: rotate(45deg);
  background: #f8fafc;
  border-left: 1px solid rgba(148,163,184,0.35);
  border-bottom: 1px solid rgba(148,163,184,0.35);
  border-radius: 6px;
}
.shape-flyout-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.shape-flyout-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shape-flyout-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.shape-flyout-subtitle {
  font-size: 12px;
  color: #64748b;
}
.shape-flyout-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  color: #334155;
}
.shape-flyout-body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}
.shape-flyout-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shape-flyout-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.shape-flyout-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}
.shape-flyout-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
}
.shape-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.shape-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-height: 112px;
  padding: 10px;
  text-align: left;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15,23,42,0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.shape-choice-btn:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 14px 24px rgba(37,99,235,0.12);
}
.shape-choice-btn:focus-visible {
  outline: 3px solid rgba(59,130,246,0.28);
  outline-offset: 2px;
}
.shape-choice-btn span {
  display: block;
}
.shape-choice-label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  color: #1e293b;
}
.shape-choice-preview {
  width: 100%;
  height: 62px;
  display: block;
}
.shape-choice-preview path,
.shape-choice-preview rect,
.shape-choice-preview circle,
.shape-choice-preview ellipse {
  vector-effect: non-scaling-stroke;
}
.side-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 10px;
}
.side-title {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.pages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.page-list-btn {
  width: 100%;
  text-align: left;
  padding: 9px;
  border-radius: 13px;
  background: rgba(255,255,255,.9);
  color: #0f172a;
  font-size: 12px;
}
.page-list-btn.active {
  background: #fff1f2;
  border-color: #f43f5e;
}
.page-list-btn-master {
  border-color: #38bdf8;
  background: #ecfeff;
}
.page-list-btn small {
  display: block;
  color: #64748b;
  margin-top: 3px;
  font-size: 10px;
}
.main-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar, .ribbon, .statusbar {
  background: #fff;
  border-bottom: 1px solid #dbe2ea;
}
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.topbar-left, .topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topbar-left {
  min-width: 0;
}
.menu-bar {
  display: flex;
  align-items: stretch;
  gap: 2px;
  position: relative;
}
.menu-group {
  position: relative;
}
.menu-bar-btn {
  position: relative;
  min-width: 48px;
  padding: 6px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0f172a;
  font-weight: 400;
  box-shadow: none;
}
.menu-bar-btn::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}
.menu-bar-btn:hover,
.menu-bar-btn:focus-visible,
.menu-group.is-open .menu-bar-btn {
  background: transparent;
  color: #0f172a;
}
.menu-bar-btn:hover::after,
.menu-bar-btn:focus-visible::after,
.menu-group.is-open .menu-bar-btn::after {
  background: #9ca3af;
}
.menu-bar-btn:focus-visible {
  outline: 2px solid rgba(100, 116, 139, 0.32);
  outline-offset: -2px;
}
.menu-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  min-width: 228px;
  padding: 4px 0;
  border: 1px solid #94a3b8;
  background: #f8f8f8;
  box-shadow: 2px 2px 0 rgba(15, 23, 42, 0.18);
  z-index: 50;
}
.menu-dropdown[hidden] {
  display: none !important;
}
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #111827;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  box-shadow: none;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: #1d4ed8;
  color: #ffffff;
}
.menu-item-checkable {
  padding-left: 10px;
}
.menu-checkmark {
  width: 12px;
  min-width: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.menu-item.is-checked .menu-checkmark::before {
  content: '✓';
}
.menu-separator {
  height: 1px;
  margin: 4px 8px;
  background: #cbd5e1;
}
.legacy-command-bar[hidden] {
  display: none !important;
}
.grid-snap-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.grid-snap-controls button.is-active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}
.grid-snap-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}
.grid-snap-field input {
  width: 58px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  text-align: right;
  font: inherit;
  color: #0f172a;
}
.grid-snap-field input:focus {
  outline: none;
}
.grid-snap-field span:last-child {
  min-width: 20px;
  color: #64748b;
}
.doc-title-wrap {
  display: flex;
  justify-content: center;
}
.doc-title {
  max-width: 360px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  border-radius: 14px;
}
.zoom-label {
  min-width: 54px;
  text-align: center;
  font-weight: 700;
}
.ribbon {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.ribbon-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 12px;
}
.ribbon-title {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}
.prop-unit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.ribbon-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ribbon-actions-geometry,
.ribbon-actions-image-tool {
  display: flex;
  align-items: flex-start;
}
.ribbon-actions-image-tool {
  flex-direction: column;
  gap: 5px;
  min-width: 154px;
}
.shape-image-fill-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}
.shape-image-fill-controls[hidden] {
  display: none !important;
}
.shape-image-pan-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
}
.shape-image-slider {
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
}
.shape-image-slider span {
  min-width: 28px;
  font-size: 11px;
  font-weight: 700;
}
.shape-image-slider input[type="range"] {
  min-width: 56px;
  padding: 0;
}
.ribbon-geometry-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
}
.ribbon-title-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ribbon-title-inline .prop-unit-badge {
  margin-left: 0;
}
.ribbon-image-btn {
  width: 100% !important;
  min-height: 30px !important;
  margin-top: 0 !important;
  white-space: nowrap;
}
.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
}
.canvas-area {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: linear-gradient(180deg, #dfe7ef 0%, #d7e0eb 100%);
  overflow: hidden;
}
.workspace-scroller {
  position: absolute;
  inset: 24px 0 24px 48px;
  overflow: auto;
}
.page-stage {
  min-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 46px 90px 90px 90px;
}
.page-surface {
  position: relative;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15,23,42,.18);
  transform-origin: top center;
}
.page-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.overlay {
  position: absolute;
  inset: 0;
}
.page-watermark {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;

  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.page-watermark img {
  max-width: 72%;
  max-height: 72%;
  object-fit: contain;
  opacity: .16;
}
.guide {
  position: absolute;
  background: rgba(148,163,184,.65);
  pointer-events: none;
}
.guide.v { width: 1px; top: 0; bottom: 0; }
.guide.h { height: 1px; left: 0; right: 0; }
.guide.guide-margin {
  background: rgba(37, 99, 235, 0.65);
}
.bleed-region {
  position: absolute;
  pointer-events: none;
  border: 1px dashed rgba(225, 29, 72, 0.82);
  background:
    repeating-linear-gradient(45deg, rgba(225, 29, 72, 0.08) 0 6px, rgba(225, 29, 72, 0) 6px 12px);
  z-index: 1;
}
.bleed-region::after {
  content: "Bleed";
  position: absolute;
  top: 5px;
  left: 7px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #be123c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bleed-trim-box {
  position: absolute;
  border: 1px solid rgba(15, 23, 42, 0.45);
  background: transparent;
}

.object-rect, .object-circle, .object-image, .object-shape, .text-box {
  position: absolute;
  user-select: none;
}
.object-rect, .object-circle, .object-shape {
  cursor: move;
}
.object-shape.shape-image-editing {
  cursor: grab;
  outline: 2px dashed rgba(14, 165, 233, 0.9);
  outline-offset: 3px;
}
.object-shape.shape-image-editing:active {
  cursor: grabbing;
}
.object-image {
  cursor: move;
  overflow: hidden;
  display: block;
  background: transparent;
}
.object-image-inner {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.object-circle { border-radius: 9999px; }
.object-shape svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.master-page-replica {
  pointer-events: none;
  outline: none;
}
.page-surface.editing-master-page {
  box-shadow: 0 0 0 3px rgba(14,165,233,0.24), 0 22px 80px rgba(15,23,42,.18);
}
.text-box {
  cursor: move;
  padding: 6px;
  overflow: hidden;
}
.text-box.editing {
  cursor: text;
  user-select: text;
  outline: none;
  background: inherit;
}
.selection-box {
  position: absolute;
  border: 2px solid #2563eb;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.85);
  pointer-events: none;
}
.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #2563eb;
  border-radius: 999px;
  pointer-events: auto;
}
.handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.ruler {
  position: absolute;
  background: #f8fafc;
  z-index: 5;
  pointer-events: none;
}
.ruler-top {
  top: 0;
  left: 48px;
  right: 0;
  height: 24px;
  border-bottom: 1px solid #cbd5e1;
}
.ruler-left {
  top: 24px;
  left: 0;
  bottom: 0;
  width: 48px;
  border-right: 1px solid #cbd5e1;
}
.ruler-tick {
  position: absolute;
  background: #94a3b8;
}
.ruler-top .ruler-tick { width: 1px; bottom: 0; }
.ruler-left .ruler-tick { height: 1px; right: 0; }
.ruler-label {
  position: absolute;
  font-size: 10px;
  color: #475569;
}
.properties {
  background: #f8fafc;
  border-left: 1px solid #dbe2ea;
  padding: 16px;
  overflow: auto;
}
.prop-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
}
.prop-title {
  font-size: 13px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}
.selection-summary {
  font-size: 14px;
  font-weight: 700;
}
.prop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.prop-grid label,
.full-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}
.full-btn {
  width: 100%;
  margin-top: 10px;
}
.statusbar {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 12px;
  color: #475569;
}
/* Keep the page canvas visible on mid-width desktop windows now that the ribbon is taller. */
@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(280px, 42vh);
  }
  .properties {
    display: block;
    border-left: 0;
    border-top: 1px solid #dbe2ea;
    padding: 12px 16px 16px;
    min-height: 0;
  }
}


.ribbon-note {
  display: inline-block;
  color: #475569;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}
.object-image {
  padding: 0 !important;
  margin: 0 !important;
  display: block;
  box-sizing: border-box;
}
.text-box {
  box-sizing: border-box;
  border: 1px dashed #2563eb;
  background: transparent;
}
.text-box.editing {
  border: 1px dashed #60a5fa;
}
.wordart-box {
  position: absolute;
  user-select: none;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial Black, Impact, sans-serif;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  -webkit-text-stroke: 2px #4c1d95;
  text-shadow:
    0 2px 0 #4c1d95,
    0 4px 0 #6d28d9,
    0 8px 14px rgba(0,0,0,.25);
}
.table-box {
  position: absolute;
  user-select: none;
  cursor: move;
  overflow: visible;
  background: #fff;
}
.table-box table {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.table-box td {
  border: 1px solid #334155;
  padding: 0;
  vertical-align: top;
  box-sizing: border-box;
}
.table-cell-editor {
  width: 100%;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  padding: 6px;
  overflow: hidden;
  outline: none;
  cursor: text;
  user-select: text;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: auto;
}
.table-cell-editor:focus {
  background: rgba(37, 99, 235, 0.06);
  box-shadow: inset 0 0 0 1px #2563eb;
}

.table-edge-hit,
.table-resize-hit {
  position: absolute;
  z-index: 8;
  background: transparent;
  pointer-events: auto;
}
.table-edge-hit.top,
.table-edge-hit.bottom {
  left: -8px;
  right: -8px;
  height: 20px;
  cursor: move;
}
.table-edge-hit.top { top: -8px; }
.table-edge-hit.bottom { bottom: -8px; }
.table-edge-hit.left,
.table-edge-hit.right {
  top: -8px;
  bottom: -8px;
  width: 20px;
  cursor: move;
}
.table-edge-hit.left { left: -8px; }
.table-edge-hit.right { right: -8px; }
.table-edge-hit.nw,
.table-edge-hit.ne,
.table-edge-hit.se,
.table-edge-hit.sw {
  width: 26px;
  height: 26px;
  cursor: move;
}
.table-edge-hit.nw { left: -10px; top: -10px; }
.table-edge-hit.ne { right: -10px; top: -10px; }
.table-edge-hit.se { right: -10px; bottom: -10px; }
.table-edge-hit.sw { left: -10px; bottom: -10px; }

.table-selection-box .table-resize-hit {
  z-index: 40;
}
.table-selection-box .table-resize-hit.n,
.table-selection-box .table-resize-hit.s {
  left: -10px;
  right: -10px;
  height: 22px;
  cursor: ns-resize;
}
.table-selection-box .table-resize-hit.n { top: -11px; }
.table-selection-box .table-resize-hit.s { bottom: -11px; }
.table-selection-box .table-resize-hit.e,
.table-selection-box .table-resize-hit.w {
  top: -10px;
  bottom: -10px;
  width: 22px;
  cursor: ew-resize;
}
.table-selection-box .table-resize-hit.e { right: -11px; }
.table-selection-box .table-resize-hit.w { left: -11px; }
.table-selection-box .table-resize-hit.nw,
.table-selection-box .table-resize-hit.ne,
.table-selection-box .table-resize-hit.se,
.table-selection-box .table-resize-hit.sw {
  width: 30px;
  height: 30px;
}
.table-selection-box .table-resize-hit.nw {
  left: -15px;
  top: -15px;
  cursor: nwse-resize;
}
.table-selection-box .table-resize-hit.ne {
  right: -15px;
  top: -15px;
  cursor: nesw-resize;
}
.table-selection-box .table-resize-hit.se {
  right: -15px;
  bottom: -15px;
  cursor: nwse-resize;
}
.table-selection-box .table-resize-hit.sw {
  left: -15px;
  bottom: -15px;
  cursor: nesw-resize;
}


.format-ribbon {
  align-items: stretch;
}
.mini-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #334155;
}
.mini-field input {
  min-width: 44px;
}
.ribbon-actions button.active-format {
  background: #dbeafe;
  border-color: #60a5fa;
}
.object-rect, .object-circle, .object-image, .object-shape, .text-box, .wordart-box, .table-box {
  transform-origin: center center;
}


.import-note {
  font-size: 13px;
  color: #cbd5e1;
  margin-top: 10px;
  line-height: 1.3;
}
.wordart-box.wordart-arch {
  border-radius: 999px / 35%;
}
.wordart-box .wordart-inner {
  width: 100%;
  height: 100%;
  text-align: inherit;
  white-space: pre-wrap;
  box-sizing: border-box;
}
.wordart-box.wordart-shadow .wordart-inner {
  filter: drop-shadow(0 4px 0 rgba(76,29,149,.75)) drop-shadow(0 10px 12px rgba(0,0,0,.18));
}


.object-bgsvg {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  user-select: none;
}


.text-box {
  min-height: 24px;
}

.text-box.editing {
  cursor: text;
  overflow: auto;
}

.text-edge-hit {
  position: absolute;
  background: transparent;
  z-index: 3;
}

.text-edge-hit.top,
.text-edge-hit.bottom {
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: move;
}

.text-edge-hit.left,
.text-edge-hit.right {
  top: 10px;
  bottom: 10px;
  width: 8px;
  cursor: move;
}

.text-edge-hit.top { top: -4px; }
.text-edge-hit.bottom { bottom: -4px; }
.text-edge-hit.left { left: -4px; }
.text-edge-hit.right { right: -4px; }


.text-edge-hit.top,
.text-edge-hit.bottom {
  left: 4px;
  right: 4px;
  height: 24px;
}

.text-edge-hit.left,
.text-edge-hit.right {
  top: 4px;
  bottom: 4px;
  width: 24px;
}

.text-edge-hit.top { top: -12px; }
.text-edge-hit.bottom { bottom: -12px; }
.text-edge-hit.left { left: -12px; }
.text-edge-hit.right { right: -12px; }


.ribbon-group-arrange .ribbon-actions-arrange {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.ribbon-group-arrange .arrange-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.ribbon-group-arrange .arrange-row button {
  white-space: nowrap;
}


/* v21e appearance layout */
.ribbon-actions-appearance {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.ribbon-actions-appearance .arrange-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.mini-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  min-height: 36px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  color: #0f172a;
  box-sizing: border-box;
}

.mini-field span {
  display: inline-block;
  white-space: nowrap;
}

.mini-field input {
  height: 28px;
  padding: 4px 8px;
}

.mini-field input[type="color"] {
  width: 38px;
  min-width: 38px;
  padding: 2px;
}

.mini-field-opacity {
  min-width: 0;
}


/* v21f compact top bar fix */
.topbar {
  padding: 10px 14px;
}

.ribbon {
  padding: 8px 12px;
  gap: 12px;
}

.ribbon-group {
  padding: 7px 9px;
}

.ribbon-title {
  margin-bottom: 4px;
  line-height: 1.1;
}

.ribbon-actions {
  gap: 6px;
}

.ribbon-actions button {
  padding: 7px 10px;
  min-height: 32px;
}

.ribbon-actions-appearance {
  gap: 4px;
}

.ribbon-actions-appearance .arrange-row {
  gap: 6px;
}

.mini-field {
  padding: 5px 8px;
  min-height: 32px;
  gap: 6px;
}

.mini-field input {
  height: 24px;
  padding: 2px 6px;
}

.mini-field input[type="color"] {
  width: 32px;
  min-width: 32px;
  padding: 1px;
}

.workspace {
  min-height: 0;
}


/* v21g force page visibility */
html, body {
  height: 100%;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
}

.main-shell {
  min-height: 0;
  overflow: hidden;
}

.topbar,
.ribbon,
.statusbar {
  flex: 0 0 auto;
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.canvas-area {
  min-height: 0;
  overflow: hidden;
}

.workspace-scroller {
  inset: 12px 0 12px 48px;
  min-height: 0;
}

.page-stage {
  min-height: 100%;
  padding: 18px 40px 40px 40px;
  align-items: flex-start;
  justify-content: center;
}

.page-surface {
  margin: 0 auto;
}

.properties {
  min-height: 0;
  overflow: auto;
}


.text-box span, .text-box b, .text-box strong, .text-box i, .text-box em, .text-box u, .text-box font {
  white-space: inherit;
}
.text-box.editing {
  overflow: auto;
}
.text-box.editing:focus {
  outline: 2px solid #60a5fa;
}


.text-box.editing {
  padding: 6px !important;
  box-sizing: border-box;
  overflow: hidden;
}

.wordart-box.editing {
  padding: 0 !important;
  overflow: hidden;
}

.rich-text-host, .rich-text-host .ql-container, .rich-text-host .ql-editor,
.text-box.editing .ql-container, .text-box.editing .ql-editor,
.wordart-box.editing .ql-container, .wordart-box.editing .ql-editor {
  width: 100%;
  height: 100%;
}

.rich-text-host .ql-container,
.text-box.editing .ql-container,
.wordart-box.editing .ql-container {
  border: none !important;
  font: inherit;
}

.rich-text-host .ql-editor,
.text-box.editing .ql-editor,
.wordart-box.editing .ql-editor {
  border: none !important;
  outline: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: auto;
  hyphens: auto;
  text-rendering: geometricPrecision;
  font-kerning: normal;
  font: inherit;
  color: inherit;
  background: transparent;
}

.wordart-box.editing .wordart-inner {
  width: 100%;
  height: 100%;
}

.active-format {
  background: #dbeafe !important;
  border-color: #60a5fa !important;
}


/* Keep textbox content in the same position in view and edit mode */
.text-box.editing {
  padding: 6px !important;
  box-sizing: border-box !important;
}


/* Keep paragraph alignment stable in and out of edit mode */
.text-box p,
.text-box div,
.wordart-box p,
.wordart-box div,
.ql-editor p {
  margin: 0;
}

.ql-editor {
  white-space: pre-wrap;
}


.mini-inline-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #334155;
}
.mini-inline-color input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}


/* keep textbox outline visible while editing */
.text-box.editing {
  border-style: dashed !important;
}
.wordart-box.editing {
  border-style: solid !important;
}


/* Use object border/background while editing instead of a fixed blue editor chrome */
.text-box.editing,
.wordart-box.editing {
  outline: none !important;
}

.text-box.editing {
  border-style: dashed !important;
}

.wordart-box.editing {
  border-style: solid !important;
}


/* Edit mode chrome follows object outline/fill instead of text color */
.text-box.editing,
.wordart-box.editing {
  outline: none !important;
}

.text-box.editing {
  box-sizing: border-box;
}

.wordart-box.editing {
  box-sizing: border-box;
}


.text-box-inner,
.wordart-inner {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: auto;
  hyphens: auto;
  text-rendering: geometricPrecision;
  font-kerning: normal;
  line-height: 1.2;
}

.text-box-inner {
  color: inherit;
}




/* Make live text-color preview visible while text remains selected */
.ql-editor ::selection {
  background: rgba(147, 197, 253, 0.28);
  color: inherit;
}
.ql-editor *::selection {
  background: rgba(147, 197, 253, 0.28);
  color: inherit;
}


.linked-text-box {
  position: absolute;
  user-select: none;
  cursor: move;
  padding: 6px;
  overflow: hidden;
  z-index: 1;
}
.linked-text-inner {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: visible;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: auto;
  hyphens: auto;
  text-rendering: geometricPrecision;
  font-kerning: normal;
  line-height: 1.2;
}
.linked-text-editor {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  box-sizing: border-box;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #111827;
  padding: 0;
  margin: 0;
  white-space: pre-wrap;
  overflow: hidden;
  cursor: text;
  pointer-events: auto;
  user-select: none;
}
.linked-text-editor-content {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
  color: #111827;
  display: none;
}
.linked-text-editor-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: auto;
  hyphens: auto;
  text-rendering: geometricPrecision;
  font-kerning: normal;
  line-height: 1.2;
  display: block;
}
.linked-text-editor-content > div,
.linked-text-editor-content > p {
  width: 100%;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  line-break: auto;
  hyphens: auto;
}
.linked-text-editor-content span {
  line-height: inherit !important;
}
.linked-text-engine-line {
  position: absolute;
  white-space: pre;
  pointer-events: none;
  visibility: visible;
  color: inherit;
  overflow: visible;
  z-index: 1;
}
.linked-text-engine-char {
  position: absolute;
  top: 0;
  display: block;
  white-space: pre;
  pointer-events: none;
  visibility: visible;
  color: inherit;
  overflow: visible;
  text-align: left;
}
.linked-text-editor-visual span {
  line-height: inherit !important;
}
.linked-text-selection-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.linked-text-selection-rect {
  position: absolute;
  background: rgba(147, 197, 253, 0.28);
  border-radius: 1px;
}
.linked-text-editor-caret {
  position: absolute;
  display: none;
  width: 1px;
  background: #2563eb;
  pointer-events: none;
  animation: linked-text-caret-blink 1s steps(1, end) infinite;
  z-index: 3;
}
.linked-text-input-proxy {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  resize: none;
  overflow: hidden;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: transparent;
}
@keyframes linked-text-caret-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
#linkedTextCursor {
  position: fixed;
  z-index: 9999;
  display: none;
  pointer-events: none;
  left: -1000px;
  top: -1000px;
  transform: translate(-50%, -50%);
}
#linkedTextCursor.linked-text-cursor-icon {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}
body.linked-text-linking,
body.linked-text-linking * {
  cursor: none !important;
}

.linked-text-box.editing {
  cursor: text;
  user-select: none;
}

.linked-text-box.editing .linked-text-inner {
  display: block;
  pointer-events: none;
}


.handle.n {
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.handle.s {
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.handle.e {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.handle.w {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}


.overflow-link-btn {
  position: absolute;
  z-index: 30;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  border: 1px solid #2563eb;
  background: #ffffff;
  color: #2563eb;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  letter-spacing: 0;
  transform: translateY(-50%);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.overflow-link-btn:hover {
  background: #dbeafe;
}


.selection-box {
  overflow: visible !important;
}

.handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 999px;
  box-sizing: border-box;
  z-index: 50;
  display: block !important;
}

.handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }

.handle.n {
  left: 50%;
  top: -6px;
  margin-left: -6px;
  cursor: ns-resize;
}
.handle.s {
  left: 50%;
  bottom: -6px;
  margin-left: -6px;
  cursor: ns-resize;
}
.handle.e {
  right: -6px;
  top: 50%;
  margin-top: -6px;
  cursor: ew-resize;
}
.handle.w {
  left: -6px;
  top: 50%;
  margin-top: -6px;
  cursor: ew-resize;
}


.selection-box { overflow: visible !important; }

.handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #2563eb;
  border-radius: 50%;
  z-index: 999;
}

.handle.nw { left: -6px; top: -6px; }
.handle.ne { right: -6px; top: -6px; }
.handle.sw { left: -6px; bottom: -6px; }
.handle.se { right: -6px; bottom: -6px; }

.handle.n { left: 50%; top: -6px; transform: translateX(-50%); }
.handle.s { left: 50%; bottom: -6px; transform: translateX(-50%); }
.handle.e { right: -6px; top: 50%; transform: translateY(-50%); }
.handle.w { left: -6px; top: 50%; transform: translateY(-50%); }


/* Final override: true centered side handles */
.selection-box {
  box-sizing: border-box;
  overflow: visible !important;
}

.selection-box .handle.n {
  left: calc(50% - 6px) !important;
  top: -6px !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin: 0 !important;
}
.selection-box .handle.s {
  left: calc(50% - 6px) !important;
  bottom: -6px !important;
  top: auto !important;
  right: auto !important;
  transform: none !important;
  margin: 0 !important;
}
.selection-box .handle.e {
  top: calc(50% - 6px) !important;
  right: -6px !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin: 0 !important;
}
.selection-box .handle.w {
  top: calc(50% - 6px) !important;
  left: -6px !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  margin: 0 !important;
}

.selection-box.wrap-editing {
  border-style: solid;
  border-color: rgba(37, 99, 235, 0.45);
}


.linked-text-box.has-hidden-overflow {
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.18);
}

.linked-text-box.has-hidden-overflow.editing {
  border-color: #dc2626 !important;
}


.linked-text-box.editing .linked-text-editor {
  position: absolute;
  inset: 6px;
  z-index: 2;
  pointer-events: auto;
  overflow-y: hidden;
  overflow-x: hidden;
}


.site-footer {
  width: 100%;
  padding: 10px 16px;
  font-size: 11px;
  color: #64748b;
  text-align: center;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.terms-link {
  margin-top: auto;
  padding: 12px;
  font-size: 11px;
  color: #64748b;
}

.terms-link a {
  color: #2563eb;
  text-decoration: none;
}

.terms-link a:hover {
  text-decoration: underline;
}

.terms-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.terms-content {
  background: #fff;
  padding: 20px;
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.terms-content h3 {
  margin: 0 0 14px;
}

.terms-content h4 {
  margin: 18px 0 8px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.terms-content p {
  margin: 0 0 11px;
}

.about-modal[hidden],
.terms-modal[hidden] {
  display: none !important;
}

.about-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.18);
  z-index: 9999;
}

.about-modal-card {
  width: min(620px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(191, 219, 254, 0.78);
  background: #ffffff;
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.22);
}

.about-modal-titlebar {
  padding: 6px 10px;
  background: linear-gradient(180deg, #12233f 0%, #0f172a 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.about-modal-body {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.about-modal-logo-pane {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.about-modal-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  background: #ffffff;
  padding: 8px;
}

.about-modal-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #334155;
}

.about-modal-heading {
  font-size: 24px;
  font-weight: 700;
  color: #14213d;
}

.about-modal-copy {
  font-size: 13px;
  line-height: 1.4;
  color: #52607a;
}

.about-modal-license-title {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.about-modal-license-panel {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
}

.about-modal-warning {
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid #dbe4f0;
  border-left: 4px solid #5b8def;
  border-radius: 16px;
  background: #f8fbff;
  font-size: 12px;
  line-height: 1.45;
  color: #334155;
}

.about-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.about-modal-actions button {
  min-width: 88px;
  border-color: #0d47a1;
  background: #0d47a1;
  color: #ffffff;
}

.about-modal-actions button:hover {
  background: #0b3f8d;
}

.welcome-modal[hidden],
.welcome-template-picker[hidden],
.welcome-warning[hidden],
.plan-modal[hidden],
.account-modal[hidden],
.billing-modal[hidden],
.master-pages-modal[hidden],
.page-setup-modal[hidden] {
  display: none !important;
}

.welcome-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,0.18), transparent 36%),
    radial-gradient(circle at bottom right, rgba(15,23,42,0.22), transparent 34%),
    rgba(8,15,28,0.62);
  backdrop-filter: blur(10px);
  z-index: 10001;
}

.welcome-modal-card {
  width: min(1160px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(148,163,184,0.24);
  background:
    linear-gradient(135deg, rgba(248,250,252,0.97), rgba(255,255,255,0.94)),
    #ffffff;
  box-shadow: 0 40px 90px rgba(15,23,42,0.32);
  padding: 28px 28px 20px;
}

.welcome-modal-header {
  margin-bottom: 20px;
}

.welcome-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.welcome-brand-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(37,99,235,0.14);
  object-fit: contain;
  padding: 10px;
}

.welcome-brand-copy h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  color: #0f172a;
}

.welcome-brand-copy p {
  margin: 8px 0 0;
  font-size: 15px;
  color: #475569;
}

.welcome-action-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.welcome-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 218px;
  padding: 16px 12px 14px;
  border-radius: 22px;
  border: 1px solid #d7e3f2;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  color: #0f172a;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.welcome-action-card:hover,
.welcome-action-card:focus-visible,
.welcome-action-card.is-active {
  transform: translateY(-2px);
  border-color: #60a5fa;
  box-shadow: 0 18px 36px rgba(59,130,246,0.16);
  background: linear-gradient(180deg, #ffffff, #eef6ff);
}

.welcome-action-card:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.welcome-action-label {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  text-align: center;
  color: #0f172a;
}

.welcome-action-paper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 94px;
  height: 128px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(148,163,184,0.18), rgba(148,163,184,0.06));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  flex: 0 0 auto;
}

.welcome-paper-sheet {
  position: relative;
  display: block;
  width: 70px;
  height: 98px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 12px 22px rgba(15,23,42,0.12);
  overflow: hidden;
}

.welcome-paper-sheet::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, rgba(203,213,225,0.95), rgba(255,255,255,0.96));
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.welcome-paper-accent {
  display: block;
  width: 100%;
  height: 14px;
  background: linear-gradient(90deg, #1d4ed8, #38bdf8);
}

.welcome-paper-line,
.welcome-paper-block,
.welcome-paper-badge {
  position: absolute;
  left: 11px;
  right: 11px;
}

.welcome-paper-line {
  height: 5px;
  border-radius: 999px;
  background: #cbd5e1;
}

.welcome-paper-line--wide {
  top: 28px;
}

.welcome-paper-line:not(.welcome-paper-line--wide):not(.welcome-paper-line--short) {
  top: 40px;
}

.welcome-paper-line--short {
  top: 52px;
  right: 24px;
}

.welcome-paper-block {
  top: 29px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8d6a5, #fdba74);
}

.welcome-paper-badge {
  top: 28px;
  left: 10px;
  right: auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: #0f172a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.welcome-action-paper--continue .welcome-paper-accent {
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
}

.welcome-action-paper--new .welcome-paper-sheet::after {
  content: "+";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
}

.welcome-action-paper--open .welcome-paper-accent {
  background: linear-gradient(90deg, #7c3aed, #f59e0b);
}

.welcome-action-paper--pub .welcome-paper-accent {
  background: linear-gradient(90deg, #0f172a, #475569);
}

.welcome-action-paper--template .welcome-paper-accent {
  background: linear-gradient(90deg, #b91c1c, #fb7185);
}

.welcome-template-picker {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #d7e3f2;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.welcome-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,251,235,0.98), rgba(255,247,237,0.96));
}

.welcome-warning-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.welcome-warning-copy strong {
  font-size: 14px;
  color: #9a3412;
}

.welcome-warning-copy span {
  font-size: 13px;
  line-height: 1.45;
  color: #7c2d12;
}

.welcome-warning-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.welcome-warning-actions a,
.welcome-warning-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.welcome-warning-actions a {
  color: #9a3412;
  border: 1px solid rgba(217, 119, 6, 0.24);
  background: rgba(255,255,255,0.88);
}

.welcome-warning-retry {
  border: 1px solid rgba(180, 83, 9, 0.24);
  background: #f97316;
  color: #ffffff;
  cursor: pointer;
}

.welcome-warning-retry:hover,
.welcome-warning-retry:focus-visible {
  background: #ea580c;
}

.welcome-template-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  margin-bottom: 12px;
}

.welcome-template-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.welcome-template-option {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #d7e3f2;
  background: #ffffff;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.welcome-template-option:hover,
.welcome-template-option:focus-visible {
  border-color: #60a5fa;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(59,130,246,0.14);
}

.welcome-template-option:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.welcome-template-option--database {
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  width: min(320px, 100%);
  min-height: 138px;
  text-align: left;
}

.welcome-template-thumb-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 88px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 4px;
}

.welcome-template-thumb {
  display: block;
  flex: 0 0 auto;
  width: clamp(48px, calc(84px * var(--thumb-ratio, 1.414)), 132px);
  height: 84px;
  aspect-ratio: var(--thumb-aspect, 1122 / 793);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(15,23,42,0.08);
  overflow: hidden;
}

.welcome-template-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.welcome-template-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.welcome-template-name,
.welcome-template-meta {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.welcome-template-name {
  font-size: 14px;
  line-height: 1.2;
  color: #0f172a;
}

.welcome-template-meta {
  font-size: 12px;
  line-height: 1.2;
  color: #64748b;
  font-weight: 600;
}

.welcome-template-paper {
  position: relative;
  width: 34px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #cbd5e1;
  box-shadow: 0 8px 16px rgba(15,23,42,0.08);
}

.welcome-template-paper::before,
.welcome-template-paper::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  border-radius: 999px;
}

.welcome-template-paper::before {
  top: 8px;
  height: 6px;
  background: #1d4ed8;
}

.welcome-template-paper::after {
  top: 19px;
  height: 4px;
  background: #cbd5e1;
  box-shadow: 0 8px 0 #cbd5e1, 0 16px 0 #cbd5e1;
}

.welcome-template-paper--flyer::before {
  background: #b91c1c;
}

.welcome-login-panel {
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid #d7e3f2;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,248,255,0.98));
}

.welcome-login-note[hidden],
.welcome-login-state[hidden],
.welcome-auth-message[hidden],
.welcome-session-chooser[hidden],
.welcome-payment-failed[hidden],
.welcome-social-row[hidden],
.welcome-auth-mode-toggle[hidden],
.welcome-login-form[hidden],
.welcome-captcha-wrap[hidden] {
  display: none !important;
}

.welcome-login-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.welcome-login-state {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
  color: #0f172a;
}

.welcome-logout-btn,
.welcome-login-btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}

.welcome-login-btn {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-color: #1d4ed8;
  color: #ffffff;
}

.welcome-login-form {
  display: grid;
  gap: 12px;
}

.welcome-login-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.welcome-login-field {
  display: grid;
  gap: 6px;
}

.welcome-login-field span {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.welcome-login-field input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}

.welcome-login-field input:focus {
  outline: 2px solid rgba(37,99,235,0.25);
  border-color: #60a5fa;
}

.welcome-login-actions {
  display: flex;
  justify-content: flex-end;
}

.topbar-account-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 6px;
}

.topbar-upgrade-btn,
.topbar-admin-btn,
.user-account-btn,
.user-account-actions button,
.plan-purchase-btn,
.welcome-social-btn,
.welcome-auth-mode-btn,
.welcome-register-link button,
.welcome-payment-failed button {
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.topbar-upgrade-btn {
  border: 1px solid #f59e0b;
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  color: #9a3412;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.16);
}

.topbar-upgrade-btn:hover,
.topbar-admin-btn:hover,
.user-account-actions button:hover,
.plan-purchase-btn:hover,
.welcome-social-btn:hover,
.welcome-auth-mode-btn:hover,
.welcome-register-link button:hover,
.welcome-payment-failed button:hover {
  transform: translateY(-1px);
}

.topbar-admin-wrap,
.user-account-wrap {
  position: relative;
}

.topbar-upgrade-btn[hidden],
.topbar-admin-wrap[hidden],
.topbar-admin-menu[hidden],
.user-account-wrap[hidden],
.user-account-menu[hidden] {
  display: none !important;
}

.topbar-admin-btn {
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
  font-weight: 700;
}

.topbar-admin-menu,
.user-account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid #d7e3f2;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  z-index: 70;
}

.topbar-admin-menu {
  min-width: 180px;
  display: grid;
  gap: 6px;
}

.topbar-admin-menu button {
  width: 100%;
  text-align: left;
  border: 1px solid #d7e3f2;
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
}

.user-account-btn {
  width: 38px;
  height: 38px;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
}

.user-account-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.user-account-menu {
  display: grid;
  gap: 12px;
}

.user-account-head {
  display: grid;
  gap: 2px;
}

.user-account-head strong {
  font-size: 15px;
  color: #0f172a;
}

.user-account-head span {
  font-size: 12px;
  color: #64748b;
}

.user-account-plan-badge,
.welcome-plan-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.user-account-plan-message,
.welcome-login-note,
.welcome-login-state-copy,
.welcome-captcha-note,
.plan-modal-header p {
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}

.user-account-plan-message {
  margin: 0;
}

.user-account-actions {
  display: grid;
  gap: 8px;
}

.user-account-actions button {
  width: 100%;
  border: 1px solid #d7e3f2;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
}

.user-account-actions button:first-child {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
}

.welcome-login-state-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.welcome-auth-message,
.plan-modal-message {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid #d7e3f2;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.welcome-auth-message[data-tone="error"],
.plan-modal-message[data-tone="error"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.welcome-auth-message[data-tone="info"],
.plan-modal-message[data-tone="info"] {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.welcome-payment-failed {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #fcd34d;
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
  color: #92400e;
}

.welcome-payment-failed strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.welcome-session-chooser {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  color: #1e3a8a;
}

.welcome-session-heading {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.welcome-session-list {
  display: grid;
  gap: 8px;
}

.welcome-session-option {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
}

.welcome-session-option:hover {
  border-color: #60a5fa;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
}

.welcome-session-title {
  font-size: 13px;
  font-weight: 800;
}

.welcome-session-meta {
  font-size: 12px;
  color: #475569;
}

.welcome-session-actions {
  display: flex;
  justify-content: flex-end;
}

.welcome-session-actions button {
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 700;
}

.welcome-payment-failed button,
.welcome-register-link button {
  justify-self: start;
  border: 1px solid #f59e0b;
  background: #ffffff;
  color: #b45309;
  font-weight: 700;
}

.welcome-social-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.welcome-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #d7e3f2;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  text-decoration: none;
}

.welcome-social-btn--google {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #ffffff, #eef2ff);
}

.welcome-social-btn--facebook {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
}

.welcome-social-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.welcome-auth-mode-toggle {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  align-self: start;
}

.welcome-auth-mode-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  font-weight: 700;
}

.welcome-auth-mode-btn.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.welcome-register-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #64748b;
}

.welcome-terms-check,
.plan-terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: #475569;
}

.inline-terms-btn {
  border: 0;
  background: transparent;
  color: #2563eb;
  padding: 0;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.inline-terms-btn:hover {
  color: #1d4ed8;
}

.welcome-terms-check input,
.plan-terms-check input {
  margin-top: 2px;
}

.welcome-captcha-wrap {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.plan-modal,
.account-modal,
.billing-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  z-index: 120;
}

.account-modal,
.billing-modal {
  backdrop-filter: blur(6px);
}

.account-modal-card,
.billing-modal-card {
  width: min(720px, 100%);
  max-height: min(840px, calc(100vh - 48px));
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: #ffffff;
  border: 1px solid rgba(191, 219, 254, 0.78);
  border-radius: 24px;
  box-shadow: 0 32px 72px rgba(15, 23, 42, 0.22);
  padding: 24px;
}

.billing-modal-card {
  width: min(920px, 100%);
}

.account-modal-header,
.billing-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.account-modal-header h3,
.billing-modal-header h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  color: #14213d;
}

.account-modal-header p,
.billing-modal-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
}

.account-modal-close,
.billing-modal-close {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #dbe4f0;
  background: #ffffff;
  color: #334155;
  font-size: 22px;
  line-height: 1;
}

.account-form {
  display: grid;
  gap: 14px;
}

.account-field {
  display: grid;
  gap: 7px;
}

.account-field span,
.billing-summary span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.account-field input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d7e3f2;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  padding: 8px 10px;
}

.account-field input[readonly] {
  background: #f8fafc;
  color: #475569;
}

.account-modal-actions,
.billing-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-modal-actions button,
.billing-actions button {
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
  font-weight: 800;
}

.billing-actions #billingCancelSubscriptionBtn {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.account-modal-message,
.billing-modal-message {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid #d7e3f2;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.account-modal-message[data-tone="error"],
.billing-modal-message[data-tone="error"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.account-modal-message[data-tone="success"],
.billing-modal-message[data-tone="success"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.account-modal-message[data-tone="info"],
.billing-modal-message[data-tone="info"] {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.billing-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.billing-summary div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #d7e3f2;
  border-radius: 14px;
  background: #f8fafc;
}

.billing-summary strong {
  color: #0f172a;
  font-size: 15px;
}

.billing-history-wrap {
  overflow: auto;
  border: 1px solid #d7e3f2;
  border-radius: 14px;
}

.billing-history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: #ffffff;
}

.billing-history-table th,
.billing-history-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 13px;
  color: #334155;
}

.billing-history-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.billing-history-table tr:last-child td {
  border-bottom: 0;
}

.master-pages-modal {
  position: fixed;
  inset: 0;
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
}

.master-pages-card {
  width: min(620px, 100%);
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid #d7e3f2;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 28px 70px rgba(15,23,42,0.26);
  padding: 18px;
}

.master-pages-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.master-pages-header h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.master-pages-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.master-pages-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.master-pages-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.master-pages-empty,
.master-page-row {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.master-pages-empty {
  padding: 18px;
  color: #64748b;
  font-size: 13px;
}

.master-page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.master-page-row:hover,
.master-page-row.is-active {
  border-color: #38bdf8;
  background: #ecfeff;
}

.master-page-row strong,
.master-page-row small {
  display: block;
}

.master-page-row small {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.master-page-row em {
  flex: 0 0 auto;
  color: #0369a1;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.master-pages-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.master-pages-actions button {
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
  padding: 0 12px;
}

.master-pages-actions button:hover,
.master-pages-close:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.page-setup-modal {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(6px);
}

.page-setup-card {
  width: min(1120px, 100%);
  max-height: min(880px, calc(100vh - 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(191, 219, 254, 0.78);
  border-radius: 28px;
  box-shadow: 0 32px 72px rgba(15, 23, 42, 0.18);
}

.page-setup-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 26px 30px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.page-setup-header h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  color: #14213d;
}

.page-setup-header p {
  margin: 8px 0 0;
  color: #52607a;
  font-size: 14px;
}

.page-setup-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid #dbe4f0;
  background: #ffffff;
  color: #334155;
  font-size: 24px;
  line-height: 1;
}

.page-setup-close:hover,
.page-setup-close:focus-visible {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.page-setup-body {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 30px;
  min-height: 0;
  overflow: hidden;
}

.page-setup-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.page-setup-main {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-setup-main-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.page-setup-main-head strong {
  display: block;
  color: #14213d;
  font-size: 18px;
}

.page-setup-main-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
}

.page-setup-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-setup-field > span {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.page-setup-field select,
.page-setup-field input,
.page-setup-custom-head select {
  border: 1px solid #d5deea;
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 14px;
  background: #ffffff;
  color: #0f172a;
}

.page-setup-field select:focus,
.page-setup-field input:focus,
.page-setup-custom-head select:focus {
  outline: none;
  border-color: #5b8def;
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.14);
}

.page-setup-orientation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.page-setup-orientation-btn {
  border: 1px solid #d5deea;
  border-radius: 14px;
  padding: 12px 14px;
  background: #ffffff;
  color: #334155;
  font-weight: 700;
}

.page-setup-orientation-btn.is-active {
  border-color: #5b8def;
  background: rgba(91, 141, 239, 0.12);
  color: #1d4ed8;
}

.page-setup-custom-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-weight: 700;
}

.page-setup-custom-box {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  background: #f8fbff;
}

.page-setup-custom-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.page-setup-custom-head strong {
  color: #14213d;
  font-size: 14px;
}

.page-setup-custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.page-setup-summary {
  min-height: 110px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 16px;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.page-setup-summary strong {
  display: block;
  margin-bottom: 8px;
  color: #14213d;
  font-size: 14px;
}

.page-setup-preset-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding-right: 6px;
}

.page-setup-preset-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #dbe4f0;
  border-radius: 20px;
  padding: 16px;
  background: #ffffff;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.page-setup-preset-card:hover,
.page-setup-preset-card:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.page-setup-preset-card.is-active {
  border-color: #5b8def;
  box-shadow: 0 18px 34px rgba(59, 130, 246, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.page-setup-preset-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.page-setup-preset-title {
  color: #14213d;
  font-size: 15px;
  font-weight: 700;
}

.page-setup-preset-type {
  color: #5b8def;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-setup-preset-size {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.page-setup-preset-desc {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.page-setup-preset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-setup-preset-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
}

.page-setup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 30px 26px;
  border-top: 1px solid #e5e7eb;
}

@media (max-width: 1080px) {
  .page-setup-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
}

.plan-modal-card {
  --plan-feature-head-height: 96px;
  --plan-feature-row-height: 58px;
  width: min(1120px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(148,163,184,0.24);
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(244,248,255,0.99));
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.plan-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.plan-modal-header h3 {
  margin: 0 0 4px;
  font-size: 28px;
  color: #0f172a;
}

.plan-modal-close {
  width: 40px;
  height: 40px;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid #d7e3f2;
  background: #ffffff;
  color: #334155;
  font-size: 24px;
  line-height: 1;
}

.plan-modal-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.05fr) repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.plan-feature-column,
.plan-column {
  display: grid;
  grid-template-rows: var(--plan-feature-head-height) auto auto;
  border-radius: 20px;
  border: 1px solid #d7e3f2;
  background: rgba(255,255,255,0.94);
  overflow: hidden;
}

.plan-column--highlight {
  border-color: #93c5fd;
  box-shadow: 0 18px 40px rgba(59, 130, 246, 0.16);
}

.plan-column.is-current {
  border-color: #34d399;
  box-shadow: inset 0 0 0 1px #34d399;
}

.plan-feature-head,
.plan-column-head {
  height: var(--plan-feature-head-height);
  box-sizing: border-box;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, rgba(248,250,252,0.98), rgba(255,255,255,0.98));
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.plan-column-head h4,
.plan-feature-head {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.plan-feature-list,
.plan-column-body {
  display: grid;
  grid-auto-rows: var(--plan-feature-row-height);
}

.plan-feature-item,
.plan-feature-value {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--plan-feature-row-height);
  min-height: 0;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
  line-height: 1.25;
  color: #334155;
  text-align: center;
  overflow: hidden;
}

.plan-feature-item {
  justify-content: flex-start;
  text-align: left;
}

.plan-feature-value--yes {
  color: #15803d;
  font-weight: 800;
  font-size: 18px;
}

.plan-feature-value--no {
  color: #dc2626;
  font-weight: 800;
  font-size: 18px;
}

.plan-feature-value--text {
  font-weight: 700;
}

.plan-price {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 900;
  color: #0f172a;
}

.plan-price span {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.plan-column-foot {
  padding: 16px;
}

.plan-purchase-btn {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
}

.plan-column--highlight .plan-purchase-btn {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #ffffff;
}

.plan-purchase-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.plan-terms-check {
  margin-top: 16px;
  width: min(560px, 100%);
  margin-left: auto;
  margin-right: 0;
}

.plan-modal-message {
  margin-top: 14px;
}

.page-watermark--unlicensed {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
  opacity: 0.16;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-watermark-band {
  position: absolute;
  left: -28%;
  right: -28%;
  display: flex;
  gap: 34px;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(185, 28, 28, 0.58);
  white-space: nowrap;
  transform: rotate(-27deg);
}

.page-watermark-band:nth-child(1) {
  top: 21%;
}

.page-watermark-band:nth-child(2) {
  top: 48%;
}

.page-watermark-band:nth-child(3) {
  top: 75%;
}

.welcome-copyright {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
  text-align: center;
}

@media (max-width: 1180px) {
  .welcome-action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .welcome-modal {
    padding: 16px;
  }

  .welcome-modal-card {
    padding: 20px 18px 18px;
  }

  .welcome-brand {
    align-items: flex-start;
  }

  .welcome-brand-copy h2 {
    font-size: 28px;
  }

  .welcome-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome-login-fields {
    grid-template-columns: 1fr;
  }

  .welcome-social-row,
  .plan-modal-grid {
    grid-template-columns: 1fr;
  }

  .topbar-account-controls {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .welcome-action-grid {
    grid-template-columns: 1fr;
  }

  .welcome-template-actions {
    flex-direction: column;
  }
}






.statusbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(160px, 1fr) auto minmax(160px, auto);
  align-items: center;
  gap: 12px;
}

.statusbar .status-selection {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.statusbar .status-selection-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  white-space: nowrap;
}

.statusbar .selection-summary {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.statusbar #statusMessage.status-left {
  justify-self: start;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
}

.statusbar #statusMeta.status-right {
  justify-self: end;
  text-align: right;
}

.statusbar .copyright {
  justify-self: center;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  pointer-events: none;
  white-space: nowrap;
  max-width: 100%;
}


/* Keep the app filling the screen with no leftover footer gap */
.app-shell {
  height: 100vh;
  overflow: hidden;
}

.main-shell {
  min-height: 0;
}

/* Keep the blue left sidebar as a vertical stack and pin Terms to the bottom */
.sidebar {
  display: flex;
  flex-direction: column;
}

.terms-link {
  margin-top: auto;
  padding-top: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  background: transparent;
}

.terms-link a {
  color: #ffffff;
  text-decoration: none;
}

.terms-link a:hover {
  text-decoration: underline;
}


/* Mac 1080p / tighter screens: make the top UI more compact without changing layout structure */
.topbar {
  gap: 8px;
  padding: 8px 12px;
}

.topbar-left, .topbar-right {
  gap: 6px;
}
.menu-bar {
  flex-wrap: wrap;
}
.grid-snap-controls {
  flex-wrap: wrap;
}

.topbar button,
.topbar .zoom-label,
.ribbon button,
.ribbon select,
.ribbon input,
.properties button,
.sidebar button {
  font-size: 14px;
}

.topbar button,
.topbar-right button,
.topbar-left button {
  padding: 6px 10px;
  min-height: 30px;
  border-radius: 10px;
}
.topbar .menu-bar-btn {
  padding: 6px 12px;
  min-height: 28px;
  border-radius: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  color: #14213d;
}

.topbar .menu-bar-btn:hover,
.topbar .menu-bar-btn:focus-visible,
.topbar .menu-group.is-open .menu-bar-btn {
  color: #14213d;
  background: transparent;
}

.topbar .menu-item {
  min-height: auto;
  border-radius: 0;
}
.grid-snap-field {
  min-height: 30px;
}

.doc-title {
  max-width: 300px;
  font-size: 16px;
  border-radius: 12px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.zoom-label {
  min-width: 46px;
}

.ribbon {
  gap: 10px;
  padding: 8px 12px;
}

.ribbon-group {
  padding: 8px 10px;
  border-radius: 12px;
}

.ribbon-title {
  margin-bottom: 6px;
  font-size: 11px;
}

.ribbon-actions {
  gap: 6px;
}

.ribbon button,
.ribbon select,
.ribbon input {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 10px;
}

.font-family-compact {
  width: 270px;
  max-width: 270px;
}

.font-family-native-select {
  display: none !important;
}

.font-family-picker-trigger {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #d7e0ee;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.font-family-picker-trigger:hover,
.font-family-picker-trigger:focus-visible {
  border-color: #93b4ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  outline: none;
}

.font-family-picker-current {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-family-picker-caret {
  flex: 0 0 auto;
  color: #64748b;
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 1;
}

.font-family-picker-panel {
  position: fixed;
  z-index: 10000;
  display: none;
  flex-direction: column;
  gap: 8px;
  max-height: min(460px, calc(100vh - 18px));
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
}

.font-family-picker-panel.is-open {
  display: flex;
}

.font-family-picker-search {
  width: 100%;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.font-family-picker-list {
  max-height: 380px;
  overflow: auto;
  border-radius: 8px;
}

.font-family-picker-section {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 9px 4px;
  background: #f8fafc;
  color: #475569;
  font: 700 10px/1.2 Arial, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.font-family-picker-option {
  width: 100%;
  min-height: 32px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #0f172a;
  display: block;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.font-family-picker-option:hover,
.font-family-picker-option:focus-visible,
.font-family-picker-option.is-selected {
  background: #eaf1ff;
  outline: none;
}

.font-family-picker-empty {
  padding: 14px 10px;
  color: #64748b;
  font: 12px/1.3 Arial, sans-serif;
}

.font-style-compact {
  width: 140px;
  max-width: 140px;
}

.font-size-compact {
  width: 58px;
  max-width: 58px;
}

.mini-inline-color {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 10px;
}

.format-ribbon {
  align-items: flex-start;
}

.text-ribbon-actions,
.paragraph-ribbon-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-ribbon-row,
.paragraph-ribbon-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

@media (max-width: 1440px), (max-height: 1080px) {
  .topbar {
    padding: 7px 10px;
    gap: 6px;
  }

  .topbar button,
  .topbar-right button,
  .topbar-left button {
    padding: 5px 8px;
    min-height: 28px;
    font-size: 11px;
  }

  .doc-title {
    max-width: 260px;
    font-size: 15px;
  }

  .zoom-label {
    min-width: 42px;
    font-size: 11px;
  }

  .ribbon {
    gap: 8px;
    padding: 7px 10px;
  }

  .ribbon-group {
    padding: 7px 8px;
  }

  .ribbon button,
  .ribbon select,
  .ribbon input {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11px;
  }

  .font-family-compact {
    width: 150px;
    max-width: 150px;
  }

  .font-style-compact {
    width: 120px;
    max-width: 120px;
  }

  .font-size-compact {
    width: 52px;
    max-width: 52px;
  }
}


/* Appearance panel compact controls */
.appearance,
.appearance-box,
.appearance-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.appearance button,
.appearance input,
.appearance select,
.appearance-box button,
.appearance-box input,
.appearance-box select,
.appearance-panel button,
.appearance-panel input,
.appearance-panel select {
  font-size: 11px;
  padding: 4px 8px;
  min-height: 28px;
  border-radius: 10px;
}

/* Specific tweaks for color + numeric fields */
.appearance input[type="number"],
.appearance-panel input[type="number"] {
  width: 60px;
}

.appearance input[type="color"],
.appearance-panel input[type="color"] {
  height: 28px;
  padding: 2px;
}

/* Ensure consistency with ribbon */
.ribbon .appearance button,
.ribbon .appearance input,
.ribbon .appearance select {
  min-height: 28px;
  padding: 4px 8px;
}

/* Publisher-style text box ribbon */
.publisher-text-ribbon {
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px 8px;
  background: linear-gradient(180deg, #f8fbfe 0%, #edf3f9 100%);
  border-bottom: 1px solid #d7e2ee;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
  overflow: visible;
}

.publisher-text-ribbon .ribbon-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 118px;
  padding: 9px 10px 6px;
  border-radius: 10px;
  border-color: #d6dde7;
  background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(241,246,252,0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
}

.publisher-text-ribbon .ribbon-title {
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #5f6f84;
  text-align: center;
}

.publisher-text-ribbon .ribbon-actions {
  gap: 6px;
  flex-wrap: nowrap;
}

.publisher-text-ribbon button,
.publisher-text-ribbon select,
.publisher-text-ribbon input {
  min-height: 32px;
  border-radius: 8px;
  font-size: 11px;
}

.publisher-text-ribbon button:disabled,
.publisher-text-ribbon select:disabled,
.publisher-text-ribbon input:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: #f1f5f9;
}

.ribbon-group-clipboard {
  min-width: 176px;
}

.ribbon-actions-clipboard {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.ribbon-tall-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 82px;
  min-height: 84px !important;
  padding: 8px 10px !important;
  text-align: center;
  white-space: nowrap;
}

.ribbon-tall-btn span,
.ribbon-mini-btn span {
  font-weight: 600;
}

.ribbon-compact-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 74px;
}

.ribbon-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 39px !important;
  padding: 6px 10px !important;
  white-space: nowrap;
}

.ribbon-inline-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.toolbar-icon-lg {
  width: 22px;
  height: 22px;
}

.ribbon-group-font {
  min-width: 512px;
}

.ribbon-actions-font,
.ribbon-actions-textbox {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-ribbon-row-font-family {
  align-items: stretch;
}

.publisher-text-ribbon .font-family-compact {
  width: 278px;
  max-width: 278px;
}

.publisher-text-ribbon .font-style-compact {
  width: 144px;
  max-width: 144px;
}

.publisher-text-ribbon .font-size-compact {
  width: 60px;
  max-width: 60px;
  text-align: center;
}

.char-spacing-compact {
  width: 112px;
  max-width: 112px;
}

.line-spacing-compact {
  width: 72px;
  max-width: 72px;
}

.text-fit-compact {
  width: 148px;
  max-width: 148px;
}

.text-direction-compact {
  width: 108px;
  max-width: 108px;
}

.publisher-text-ribbon .mini-inline-color {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
}

.publisher-text-ribbon .mini-inline-color input[type="color"] {
  width: 26px;
  min-width: 26px;
  height: 24px;
}

.publisher-text-ribbon .icon-btn {
  min-width: 32px;
  width: 32px;
  height: 32px;
}

.publisher-text-ribbon .icon-btn-label {
  width: auto;
  min-width: 78px;
  padding: 0 10px;
  gap: 6px;
}

.publisher-text-ribbon .icon-btn-label span {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.ribbon-group-paragraph {
  min-width: 292px;
}

.publisher-text-ribbon .paragraph-ribbon-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.publisher-text-ribbon .paragraph-ribbon-row,
.publisher-text-ribbon .text-ribbon-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.ribbon-group-linking {
  min-width: 202px;
}

.ribbon-actions-linking {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.ribbon-tall-btn-link {
  min-width: 94px;
}

.ribbon-group-textbox {
  min-width: 536px;
}

.ribbon-group-table {
  min-width: 188px;
}

.ribbon-actions-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-ribbon-row-table {
  justify-content: flex-start;
}

.publisher-text-ribbon .mini-field-table input[type="number"] {
  width: 54px;
  min-width: 54px;
}

.text-ribbon-row-columns {
  justify-content: flex-start;
}

.publisher-text-ribbon .mini-field {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 8px;
}

.publisher-text-ribbon .mini-field input {
  height: 22px;
  min-width: 44px;
  padding: 2px 6px;
}

.publisher-text-ribbon .mini-field-columns input[type="number"] {
  width: 54px;
  min-width: 54px;
}

.textbox-margin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mini-field-margin {
  width: 100%;
  justify-content: space-between;
}

.mini-field-margin input[type="number"] {
  width: 46px;
  min-width: 46px;
}

.publisher-text-ribbon .ribbon-actions button.active-format {
  background: linear-gradient(180deg, #dcebff 0%, #bfdbfe 100%);
  border-color: #7aa6ef;
  color: #0f3b75;
}

.publisher-text-ribbon .ribbon-tall-btn.active-format,
.publisher-text-ribbon .ribbon-mini-btn.active-format {
  background: linear-gradient(180deg, #dcebff 0%, #bfdbfe 100%);
  border-color: #7aa6ef;
  color: #0f3b75;
}

@media (max-width: 1560px) {
  .publisher-text-ribbon {
    gap: 6px;
    padding-inline: 10px;
  }

  .publisher-text-ribbon .ribbon-group {
    min-height: 112px;
    padding-inline: 8px;
  }

  .ribbon-group-font {
    min-width: 484px;
  }

  .publisher-text-ribbon .font-family-compact {
    width: 168px;
    max-width: 168px;
  }
}

.format-ribbon.publisher-text-ribbon {
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  align-items: stretch !important;
}


/* Compact the actual Appearance controls */
#formatStroke,
#formatFill,
#formatOpacity,
#formatStrokeWidth {
  min-height: 28px !important;
  height: 28px !important;
  font-size: 11px !important;
  border-radius: 10px !important;
  box-sizing: border-box;
}

#formatOpacity,
#formatStrokeWidth {
  width: 56px !important;
  max-width: 56px !important;
  padding: 4px 6px !important;
}

#formatStroke,
#formatFill {
  width: 34px !important;
  min-width: 34px !important;
  padding: 2px !important;
}

label[for="formatStroke"],
label[for="formatFill"],
label[for="formatOpacity"],
label[for="formatStrokeWidth"] {
  font-size: 11px !important;
}

.ribbon-actions #formatStroke,
.ribbon-actions #formatFill,
.ribbon-actions #formatOpacity,
.ribbon-actions #formatStrokeWidth {
  min-height: 28px !important;
  height: 28px !important;
}

@media (max-width: 1440px), (max-height: 1080px) {
  #formatStroke,
  #formatFill,
  #formatOpacity,
  #formatStrokeWidth {
    min-height: 26px !important;
    height: 26px !important;
    font-size: 10px !important;
  }

  #formatOpacity,
  #formatStrokeWidth {
    width: 50px !important;
    max-width: 50px !important;
    padding: 3px 5px !important;
  }

  #formatStroke,
  #formatFill {
    width: 30px !important;
    min-width: 30px !important;
  }
}


/* FORCE override Appearance controls (higher specificity) */
.ribbon-actions-appearance .mini-field input {
  height: 28px !important;
  min-height: 28px !important;
  font-size: 11px !important;
  padding: 4px 6px !important;
  border-radius: 8px !important;
}

/* Override inline width styles */
.ribbon-actions-appearance input[type="number"] {
  width: 55px !important;
  max-width: 55px !important;
}

/* Color pickers smaller */
.ribbon-actions-appearance input[type="color"] {
  width: 32px !important;
  height: 28px !important;
  padding: 2px !important;
}

/* Tighten spacing */
.ribbon-actions-appearance .arrange-row {
  gap: 6px !important;
}

/* Reduce label size */
.ribbon-actions-appearance .mini-field span {
  font-size: 10px !important;
}


.linked-text-editor {
  line-height: 1.2 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}


.linked-text-inner {
  white-space: pre-wrap !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  line-break: auto !important;
  hyphens: auto !important;
  line-height: 1.2 !important;
}

.linked-text-inner .story-paragraph {
  width: 100%;
}

.linked-text-inner span {
  line-height: inherit !important;
}

.linked-text-editor {
  white-space: pre-wrap !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  line-break: auto !important;
  hyphens: auto !important;
  line-height: 1.2 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}


.linked-text-editor {
  min-height: 100%;
}


/* v2 ruler alignment and paragraph ribbon width fix */
.format-ribbon {
  align-items: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}
.format-ribbon .ribbon-group {
  flex: 0 0 auto;
}
.ribbon-group-paragraph {
  width: auto !important;
  min-width: 0 !important;
  max-width: fit-content;
}
.ribbon-group-paragraph .ribbon-actions {
  flex-wrap: nowrap;
}
.ribbon-group-columns {
  width: auto !important;
  min-width: 0 !important;
  max-width: fit-content;
}
.ribbon-actions-columns {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}
.mini-field-columns {
  min-width: 0;
}
.mini-field-columns input[type="number"] {
  width: 64px;
  min-width: 64px;
}
.canvas-area {
  overflow: hidden;
}
.workspace-scroller {
  inset: 24px 0 24px 48px;
}
.ruler-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 24px;
  background: #f8fafc;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  z-index: 6;
  pointer-events: none;
}
.ruler {
  z-index: 6;
  overflow: hidden;
}
.ruler-left {
  width: 48px;
}
.ruler-label-left {
  left: 2px;
  right: auto;
  width: 42px;
  text-align: left;
  line-height: 12px;
  white-space: nowrap;
}
.ruler-label-top {
  white-space: nowrap;
}


/* April 2026 toolbar and right-panel refinements */
.workspace-scroller {
  inset: 24px 0 0 48px;
}

.statusbar {
  border-top: 0 !important;
  box-shadow: none !important;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  width: 34px;
  padding: 0 !important;
}

.toolbar-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.ribbon-group-paragraph .icon-btn {
  min-width: 36px;
  width: 36px;
}

.properties {
  overflow-y: auto;
}

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

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

.prop-mini-field {
  width: 100%;
  justify-content: space-between;
  padding: 8px 10px;
}

.prop-mini-field span {
  font-size: 11px;
}

.prop-mini-field input[type="number"] {
  width: 62px;
  min-width: 62px;
}

.prop-mini-field input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 1px;
  border: 0;
  background: transparent;
}

.mirror-action-btn {
  min-height: 32px;
}

.right-toolbar-arrange-card {
  display: none;
}

.paragraph-card.is-disabled {
  opacity: 0.72;
}

.paragraph-card select,
.paragraph-card input[type="number"] {
  width: 100%;
}

.paragraph-style-row {
  margin-bottom: 10px;
}

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

.paragraph-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.paragraph-toggle-row-split {
  justify-content: space-between;
}

.paragraph-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
}

.paragraph-check input[type="checkbox"] {
  margin: 0;
}

.paragraph-footer-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.paragraph-footer-row .prop-mini-field {
  max-width: 100%;
}

.paragraph-footer-row-extended {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.paragraph-tab-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 10px;
  align-items: end;
}

.paragraph-tab-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.paragraph-tab-actions button {
  min-width: 30px;
  height: 30px;
  padding: 0;
  margin: 0;
}

.paragraph-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.paragraph-action-row button {
  margin-top: 0;
}

.text-art-card select {
  width: 100%;
}

.text-art-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.text-art-action-row button {
  margin-top: 0;
}

.text-art-summary {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #475569;
}

.text-art-card.is-disabled {
  opacity: 0.72;
}

.wrap-card.is-disabled {
  opacity: 0.72;
}

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

.wrap-card select,
.wrap-card input[type="number"] {
  width: 100%;
}

.wrap-actions {
  margin-top: 10px;
}

.wrap-note {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #64748b;
}

.wrap-edit-active {
  background: #dbeafe !important;
  border-color: #60a5fa !important;
  color: #1d4ed8;
}

.ribbon-source-card {
  display: none;
}

.ribbon-source-stash {
  display: none !important;
}

@media (min-width: 1041px) {
  .workspace {
    display: flex;
  }
}

.publisher-text-ribbon {
  padding: 4px 6px !important;
  gap: 4px !important;
  align-items: stretch !important;
}

.publisher-text-ribbon .ribbon-group {
  min-height: 84px !important;
  padding: 4px 6px 3px !important;
  gap: 4px !important;
  border-radius: 7px !important;
}

.publisher-text-ribbon .ribbon-title {
  padding-top: 3px !important;
  font-size: 9px !important;
  line-height: 1 !important;
}

.publisher-text-ribbon button,
.publisher-text-ribbon select,
.publisher-text-ribbon input {
  min-height: 24px !important;
  font-size: 10px !important;
  border-radius: 5px !important;
  padding: 2px 6px !important;
}

.publisher-text-ribbon .ribbon-actions {
  gap: 4px !important;
}

.publisher-text-ribbon .text-ribbon-row,
.publisher-text-ribbon .paragraph-ribbon-row {
  gap: 4px !important;
}

.publisher-text-ribbon .toolbar-icon {
  width: 20px !important;
  height: 20px !important;
}

.publisher-text-ribbon .toolbar-icon-lg {
  width: 27px !important;
  height: 27px !important;
}

.publisher-text-ribbon .icon-btn {
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
}

.publisher-text-ribbon .icon-btn-label {
  min-width: 60px !important;
  padding: 0 6px !important;
  gap: 4px !important;
}

.publisher-text-ribbon .icon-btn-label span {
  font-size: 9px !important;
}

.publisher-text-ribbon .ribbon-tall-btn {
  min-width: 56px !important;
  min-height: 58px !important;
  gap: 4px !important;
  padding: 4px 5px !important;
}

.publisher-text-ribbon .ribbon-mini-btn {
  min-height: 24px !important;
  gap: 5px !important;
  padding: 3px 6px !important;
}

.publisher-text-ribbon .ribbon-compact-stack {
  min-width: 58px !important;
  gap: 4px !important;
}

.publisher-text-ribbon .ribbon-inline-pair {
  gap: 4px !important;
}

.publisher-text-ribbon .font-family-compact {
  width: 196px !important;
  max-width: 196px !important;
}

.publisher-text-ribbon .font-style-compact {
  width: 92px !important;
  max-width: 92px !important;
}

.publisher-text-ribbon .font-size-compact {
  width: 46px !important;
  max-width: 46px !important;
}

.publisher-text-ribbon .char-spacing-compact {
  width: 88px !important;
  max-width: 88px !important;
}

.publisher-text-ribbon .line-spacing-compact {
  width: 56px !important;
  max-width: 56px !important;
}

.publisher-text-ribbon .text-fit-compact {
  width: 118px !important;
  max-width: 118px !important;
}

.publisher-text-ribbon .text-direction-compact {
  width: 88px !important;
  max-width: 88px !important;
}

.publisher-text-ribbon .mini-inline-color {
  min-height: 24px !important;
  padding: 0 6px !important;
}

.publisher-text-ribbon .mini-inline-color input[type="color"] {
  width: 22px !important;
  min-width: 22px !important;
  height: 18px !important;
}

.publisher-text-ribbon .mini-field {
  min-height: 24px !important;
  padding: 2px 6px !important;
  gap: 4px !important;
  border-radius: 6px !important;
}

.publisher-text-ribbon .mini-field span {
  font-size: 9px !important;
}

.publisher-text-ribbon .mini-field input {
  height: 18px !important;
  min-width: 34px !important;
  padding: 1px 4px !important;
}

.publisher-text-ribbon .mini-field-columns input[type="number"] {
  width: 42px !important;
  min-width: 42px !important;
}

.publisher-text-ribbon .mini-field-margin input[type="number"] {
  width: 34px !important;
  min-width: 34px !important;
}

.publisher-text-ribbon .textbox-margin-grid {
  gap: 4px !important;
}

.publisher-text-ribbon .ribbon-group-clipboard {
  min-width: 122px !important;
}

.publisher-text-ribbon .ribbon-group-font {
  min-width: 350px !important;
}

.publisher-text-ribbon .ribbon-group-paragraph {
  min-width: 182px !important;
}

.publisher-text-ribbon .ribbon-group-styles {
  min-width: 172px;
}

.publisher-text-ribbon .ribbon-group-flow {
  min-width: 156px;
}

.publisher-text-ribbon .ribbon-group-objects {
  min-width: 194px;
}

.publisher-text-ribbon .ribbon-group-linking {
  min-width: 150px !important;
}

.publisher-text-ribbon .ribbon-group-textbox {
  min-width: 334px !important;
}

.publisher-text-ribbon .ribbon-group-wrap {
  min-width: 148px;
}

.publisher-text-ribbon .ribbon-group-arrange {
  min-width: 122px;
}

.publisher-text-ribbon .ribbon-group-editing {
  min-width: 72px;
}

.publisher-text-ribbon .style-compact {
  width: 146px;
  max-width: 146px;
}

.publisher-text-ribbon .textart-preset-compact {
  width: 116px;
  max-width: 116px;
}

.publisher-text-ribbon .wrap-mode-compact {
  width: 116px;
  max-width: 116px;
}

.publisher-text-ribbon .mini-field-wrap input[type="number"] {
  width: 36px;
  min-width: 36px;
}

.text-ribbon-row-styles,
.text-ribbon-row-wrap {
  justify-content: space-between;
}

.ribbon-actions-styles,
.ribbon-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.ribbon-toggle-btn {
  min-height: 24px !important;
  padding: 0 6px !important;
  font-size: 9px !important;
  white-space: nowrap;
}

.ribbon-object-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.ribbon-stack-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 50px !important;
  min-width: 56px;
  padding: 4px 2px !important;
  text-align: center;
}

.ribbon-stack-btn span {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.05;
  white-space: nowrap;
}

.ribbon-actions-arrange,
.ribbon-actions-editing {
  display: block !important;
}

.ribbon-icon-grid {
  display: grid;
  gap: 4px;
}

.arrange-icon-grid {
  grid-template-columns: repeat(4, 24px);
}

.editing-icon-grid {
  grid-template-columns: repeat(2, 24px);
}

.ribbon-actions-appearance .mini-field {
  min-height: 24px !important;
  padding: 2px 5px !important;
  gap: 4px !important;
}

.ribbon-actions-appearance .mini-field span {
  font-size: 9px !important;
}

.ribbon-actions-appearance input[type="number"] {
  width: 42px !important;
  max-width: 42px !important;
}

.ribbon-actions-appearance input[type="color"] {
  width: 24px !important;
  min-width: 24px !important;
  height: 18px !important;
}

.wrap-outline-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 28;
}

.wrap-outline-path {
  fill: rgba(37, 99, 235, 0.1);
  stroke: #2563eb;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
}

.wrap-point-handle,
.wrap-point-add {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #2563eb;
  background: #2563eb;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 29;
}

.wrap-point-handle {
  cursor: move;
}

.wrap-point-add {
  width: 8px;
  height: 8px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #2563eb;
  cursor: copy;
}

.wrap-margin-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 9;
}

.wrap-margin-path {
  fill: none;
  stroke: rgba(37, 99, 235, 0.32);
  stroke-width: 1.25;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}

.wrap-margin-path.is-selected {
  stroke: rgba(37, 99, 235, 0.72);
  stroke-width: 1.5;
}

@media (max-width: 720px) {
  .about-modal-body {
    grid-template-columns: 1fr;
  }

  .about-modal-logo-pane {
    justify-content: flex-start;
  }
}

/* Final compact Publisher-style ribbon pass */
.publisher-text-ribbon {
  padding: 5px 8px !important;
  gap: 5px !important;
}

.publisher-text-ribbon .ribbon-group {
  min-height: 105px !important;
  padding: 5px 8px 4px !important;
  gap: 5px !important;
  border-radius: 8px !important;
}

.publisher-text-ribbon .ribbon-title {
  padding-top: 4px !important;
  font-size: 11px !important;
  letter-spacing: 0.02em !important;
}

.publisher-text-ribbon button,
.publisher-text-ribbon select,
.publisher-text-ribbon input {
  min-height: 30px !important;
  font-size: 12px !important;
  border-radius: 5px !important;
  padding: 3px 8px !important;
}

.publisher-text-ribbon .ribbon-actions,
.publisher-text-ribbon .text-ribbon-row,
.publisher-text-ribbon .paragraph-ribbon-row,
.publisher-text-ribbon .ribbon-inline-pair,
.publisher-text-ribbon .ribbon-compact-stack,
.publisher-text-ribbon .textbox-margin-grid {
  gap: 5px !important;
}

.publisher-text-ribbon .ribbon-actions-font,
.publisher-text-ribbon .ribbon-actions-appearance {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  flex-wrap: nowrap !important;
}

.publisher-text-ribbon .text-ribbon-row-font-extra,
.publisher-text-ribbon .ribbon-actions-appearance .arrange-row {
  width: 100%;
}

.publisher-text-ribbon .toolbar-icon {
  width: 25px !important;
  height: 25px !important;
}

.publisher-text-ribbon .toolbar-icon-lg {
  width: 34px !important;
  height: 34px !important;
}

.publisher-text-ribbon .icon-btn {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
}

.publisher-text-ribbon .icon-btn-label {
  min-width: 63px !important;
  gap: 5px !important;
  padding: 0 8px !important;
}

.publisher-text-ribbon .icon-btn-label span,
.publisher-text-ribbon .mini-field span,
.publisher-text-ribbon .ribbon-stack-btn span,
.publisher-text-ribbon .ribbon-toggle-btn {
  font-size: 11px !important;
}

.publisher-text-ribbon .ribbon-tall-btn {
  min-width: 54px !important;
  min-height: 56px !important;
  gap: 4px !important;
  padding: 4px 5px !important;
}

.publisher-text-ribbon .ribbon-mini-btn {
  min-height: 30px !important;
  padding: 4px 8px !important;
}

.publisher-text-ribbon .font-family-compact {
  width: 160px !important;
  max-width: 160px !important;
}

.publisher-text-ribbon .font-style-compact {
  width: 105px !important;
  max-width: 105px !important;
}

.publisher-text-ribbon .font-size-compact {
  width: 52px !important;
  max-width: 52px !important;
}

.publisher-text-ribbon .char-spacing-compact {
  width: 98px !important;
  max-width: 98px !important;
}

.publisher-text-ribbon .line-spacing-compact {
  width: 63px !important;
  max-width: 63px !important;
}

.publisher-text-ribbon .text-fit-compact {
  width: 120px !important;
  max-width: 120px !important;
}

.publisher-text-ribbon .text-direction-compact {
  width: 92px !important;
  max-width: 92px !important;
}

.publisher-text-ribbon .style-compact {
  width: 162px !important;
  max-width: 162px !important;
}

.publisher-text-ribbon .textart-preset-compact,
.publisher-text-ribbon .wrap-mode-compact {
  width: 130px !important;
  max-width: 130px !important;
}

.publisher-text-ribbon .line-mode-compact {
  width: 72px !important;
  max-width: 72px !important;
}

.publisher-text-ribbon .tab-stop-index-compact {
  width: 65px !important;
  max-width: 65px !important;
}

.publisher-text-ribbon .tab-align-compact {
  width: 82px !important;
  max-width: 82px !important;
}

.publisher-text-ribbon .tab-leader-compact {
  width: 90px !important;
  max-width: 90px !important;
}

.publisher-text-ribbon .mini-inline-color {
  min-height: 30px !important;
  padding: 0 8px !important;
}

.publisher-text-ribbon .mini-inline-color input[type="color"] {
  width: 28px !important;
  min-width: 28px !important;
  height: 23px !important;
}

.publisher-text-ribbon .mini-field {
  min-height: 30px !important;
  padding: 3px 8px !important;
  gap: 5px !important;
  border-radius: 6px !important;
}

.publisher-text-ribbon .mini-field input {
  height: 23px !important;
  min-width: 40px !important;
  padding: 2px 5px !important;
}

.publisher-text-ribbon .mini-field-columns input[type="number"] {
  width: 48px !important;
  min-width: 48px !important;
}

.publisher-text-ribbon .mini-field-margin input[type="number"],
.publisher-text-ribbon .mini-field-wrap input[type="number"],
.publisher-text-ribbon .mini-field-tab-pos input[type="number"],
.publisher-text-ribbon .mini-field-para input[type="number"] {
  width: 40px !important;
  min-width: 40px !important;
}

.publisher-text-ribbon .mini-field-geometry {
  width: auto !important;
  justify-content: flex-start !important;
}

.publisher-text-ribbon .mini-field-geometry input[type="number"] {
  width: 48px !important;
  min-width: 48px !important;
}

.publisher-text-ribbon .ribbon-group-clipboard {
  min-width: 135px !important;
}

.publisher-text-ribbon .ribbon-group-font {
  min-width: 298px !important;
  width: 298px !important;
}

.publisher-text-ribbon .ribbon-group-paragraph {
  min-width: 205px !important;
}

.publisher-text-ribbon .ribbon-group-spacing {
  min-width: 205px !important;
}

.publisher-text-ribbon .ribbon-group-tabs {
  min-width: 170px !important;
}

.publisher-text-ribbon .ribbon-group-styles {
  min-width: 195px !important;
}

.publisher-text-ribbon .ribbon-group-flow {
  min-width: 170px !important;
}

.publisher-text-ribbon .ribbon-group-objects {
  min-width: 166px !important;
}

.publisher-text-ribbon .ribbon-group-linking {
  min-width: 145px !important;
}

.publisher-text-ribbon .ribbon-group-textbox {
  min-width: 325px !important;
}

.publisher-text-ribbon .ribbon-group-wrap {
  min-width: 145px !important;
}

.publisher-text-ribbon .ribbon-group-geometry {
  min-width: 205px !important;
}

.publisher-text-ribbon .ribbon-group-image-tool {
  min-width: 175px !important;
}

.publisher-text-ribbon .ribbon-group-arrange {
  min-width: 130px !important;
}

.publisher-text-ribbon .ribbon-group-editing {
  min-width: 56px !important;
}

.publisher-text-ribbon .ribbon-toggle-btn {
  min-height: 30px !important;
  padding: 0 8px !important;
}

.publisher-text-ribbon .ribbon-object-grid {
  gap: 4px !important;
}

.publisher-text-ribbon .ribbon-stack-btn {
  min-height: 63px !important;
  min-width: 68px !important;
  gap: 4px !important;
  padding: 5px 4px !important;
}

.publisher-text-ribbon .arrange-icon-grid {
  grid-template-columns: repeat(4, 30px) !important;
  gap: 5px !important;
}

.publisher-text-ribbon .editing-icon-grid {
  grid-template-columns: repeat(2, 24px) !important;
  gap: 4px !important;
}

.publisher-text-ribbon .ribbon-actions-spacing,
.publisher-text-ribbon .ribbon-actions-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.publisher-text-ribbon .text-ribbon-row-spacing,
.publisher-text-ribbon .text-ribbon-row-tabs {
  justify-content: flex-start;
}

.publisher-text-ribbon .ribbon-actions-clipboard {
  display: block !important;
}

.publisher-text-ribbon .ribbon-clipboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.publisher-text-ribbon .ribbon-clipboard-btn {
  min-width: 58px !important;
  width: 58px !important;
  min-height: 63px !important;
  padding: 5px 4px !important;
}

.publisher-text-ribbon .ribbon-clipboard-btn span {
  white-space: nowrap;
}

.publisher-text-ribbon .ribbon-group-clipboard {
  min-width: 200px !important;
  min-height: 135px !important;
}

.publisher-text-ribbon .ribbon-group-paragraph {
  min-width: 213px !important;
}

.publisher-text-ribbon .ribbon-group-textbox {
  min-width: 340px !important;
}

.publisher-text-ribbon .textbox-margin-grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
}

.publisher-text-ribbon .mini-field-margin {
  width: auto !important;
  justify-content: flex-start !important;
}

/* May 2026 tabbed ribbon conversion */
.topbar .menu-bar-btn.is-ribbon-active {
  background: transparent !important;
  border-color: transparent !important;
  color: #14213d !important;
}

.topbar .menu-bar-btn.is-ribbon-active::after {
  background: #0d47a1 !important;
}

.publisher-text-ribbon .ribbon-group[hidden] {
  display: none !important;
}

.publisher-text-ribbon .ribbon-actions-command {
  display: block !important;
}

.publisher-text-ribbon .ribbon-command-grid {
  display: grid;
  gap: 5px;
}

.publisher-text-ribbon .ribbon-command-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.publisher-text-ribbon .ribbon-command-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.publisher-text-ribbon .ribbon-command-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.publisher-text-ribbon .ribbon-page-actions-grid {
  grid-template-columns: repeat(2, 58px);
  justify-content: start;
}

.publisher-text-ribbon .ribbon-page-actions-grid .ribbon-clipboard-btn {
  width: 58px !important;
  min-width: 58px !important;
  min-height: 63px !important;
}

.publisher-text-ribbon .ribbon-page-actions-grid .ribbon-clipboard-btn span {
  white-space: normal !important;
  line-height: 1.05 !important;
}

.publisher-text-ribbon .ribbon-action-btn span {
  white-space: normal !important;
  line-height: 1.05 !important;
  text-align: center;
}

.publisher-text-ribbon .ribbon-check-btn.is-checked {
  background: linear-gradient(180deg, #dcebff 0%, #bfdbfe 100%) !important;
  border-color: #7aa6ef !important;
  color: #0f3b75 !important;
}

.publisher-text-ribbon .ribbon-toggle-btn.is-checked {
  background: linear-gradient(180deg, #dcebff 0%, #bfdbfe 100%) !important;
  border-color: #7aa6ef !important;
  color: #0f3b75 !important;
}

.publisher-text-ribbon .ribbon-clipboard-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.publisher-text-ribbon .ribbon-group-clipboard {
  min-width: 268px !important;
}

.publisher-text-ribbon .ribbon-group-file {
  min-width: 210px !important;
}

.publisher-text-ribbon .ribbon-group-view-zoom {
  min-width: 270px !important;
}

.publisher-text-ribbon .ribbon-group-view-display,
.publisher-text-ribbon .ribbon-group-help-account {
  min-width: 135px !important;
}

.publisher-text-ribbon .ribbon-group-help-info {
  min-width: 210px !important;
}

.publisher-text-ribbon .ribbon-actions-page-setup,
.publisher-text-ribbon .ribbon-actions-page-margins,
.publisher-text-ribbon .ribbon-actions-page-guides,
.publisher-text-ribbon .ribbon-actions-page-background {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.publisher-text-ribbon .ribbon-actions-page-margins .textbox-margin-grid {
  grid-template-columns: repeat(2, auto) !important;
}

.publisher-text-ribbon .ribbon-actions-page-guides .grid-snap-controls {
  gap: 5px;
}

.publisher-text-ribbon .ribbon-actions-page-guides .grid-snap-field {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 11px;
}

.publisher-text-ribbon .ribbon-actions-page-guides .grid-snap-field input {
  width: 54px;
  height: 22px;
  min-height: 22px;
}

.publisher-text-ribbon .mini-field-page {
  width: auto !important;
  justify-content: flex-start !important;
}

.publisher-text-ribbon .mini-field-page input[type="number"] {
  width: 54px !important;
  min-width: 54px !important;
}

.publisher-text-ribbon .ribbon-actions-page-setup .ribbon-toggle-btn,
.publisher-text-ribbon .ribbon-actions-page-guides .ribbon-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.publisher-text-ribbon #pageRibbonPreset,
.publisher-text-ribbon #pageRibbonBackgroundPattern {
  width: 164px !important;
  max-width: 164px !important;
}

.publisher-text-ribbon .ribbon-group-page-setup {
  min-width: 225px !important;
}

.publisher-text-ribbon .ribbon-group-page-margins {
  min-width: 190px !important;
}

.publisher-text-ribbon .ribbon-group-page-guides {
  min-width: 240px !important;
}

.publisher-text-ribbon .ribbon-group-page-pages {
  min-width: 210px !important;
}

.publisher-text-ribbon .ribbon-group-page-background {
  min-width: 190px !important;
}

.publisher-text-ribbon .ribbon-group-page-header-footer {
  min-width: 185px !important;
}

body[data-ui-theme="dark"] {
  --codex-bg: #0b0b0b;
  --codex-surface: #141414;
  --codex-surface-raised: #1b1b1b;
  --codex-surface-hover: #232323;
  --codex-surface-active: #2b2b2b;
  --codex-border: #303030;
  --codex-border-strong: #444444;
  --codex-text: #ececec;
  --codex-text-muted: #b4b4b4;
  --codex-text-subtle: #858585;
  background: var(--codex-bg);
  color: var(--codex-text);
}

body[data-ui-theme="dark"] .app-shell,
body[data-ui-theme="dark"] .main-shell,
body[data-ui-theme="dark"] .workspace,
body[data-ui-theme="dark"] .canvas-area,
body[data-ui-theme="dark"] .workspace-scroller,
body[data-ui-theme="dark"] .page-stage {
  background: var(--codex-bg) !important;
  color: var(--codex-text) !important;
}

body[data-ui-theme="dark"] .sidebar,
body[data-ui-theme="dark"] .topbar,
body[data-ui-theme="dark"] .publisher-text-ribbon,
body[data-ui-theme="dark"] .statusbar,
body[data-ui-theme="dark"] .shape-flyout,
body[data-ui-theme="dark"] .topbar-admin-menu,
body[data-ui-theme="dark"] .user-account-menu,
body[data-ui-theme="dark"] .account-modal-card,
body[data-ui-theme="dark"] .billing-modal-card,
body[data-ui-theme="dark"] .master-pages-card,
body[data-ui-theme="dark"] .terms-content {
  background: var(--codex-surface) !important;
  color: var(--codex-text) !important;
  border-color: var(--codex-border) !important;
}

body[data-ui-theme="dark"] .ruler,
body[data-ui-theme="dark"] .ruler-corner {
  background: var(--codex-surface) !important;
  color: var(--codex-text-muted) !important;
  border-color: var(--codex-border) !important;
}

body[data-ui-theme="dark"] .ruler-tick {
  background: rgba(236, 236, 236, 0.38) !important;
}

body[data-ui-theme="dark"] .ruler-label,
body[data-ui-theme="dark"] .ruler-label-top,
body[data-ui-theme="dark"] .ruler-label-left,
body[data-ui-theme="dark"] .statusbar,
body[data-ui-theme="dark"] .statusbar .selection-summary,
body[data-ui-theme="dark"] .statusbar .status-selection-label,
body[data-ui-theme="dark"] .brand-text,
body[data-ui-theme="dark"] .shape-flyout-title,
body[data-ui-theme="dark"] .shape-flyout-subtitle {
  color: var(--codex-text-muted) !important;
}

body[data-ui-theme="dark"] .topbar button,
body[data-ui-theme="dark"] .topbar input,
body[data-ui-theme="dark"] .topbar select,
body[data-ui-theme="dark"] .publisher-text-ribbon button,
body[data-ui-theme="dark"] .publisher-text-ribbon input,
body[data-ui-theme="dark"] .publisher-text-ribbon select,
body[data-ui-theme="dark"] .sidebar button,
body[data-ui-theme="dark"] .template-btn,
body[data-ui-theme="dark"] .page-action-btn,
body[data-ui-theme="dark"] .shape-choice-btn,
body[data-ui-theme="dark"] .user-account-menu button,
body[data-ui-theme="dark"] .topbar-admin-menu button {
  background: var(--codex-surface-raised) !important;
  color: var(--codex-text) !important;
  border-color: var(--codex-border-strong) !important;
}

body[data-ui-theme="dark"] .doc-title {
  background: var(--codex-surface-raised) !important;
  color: var(--codex-text) !important;
  border-color: var(--codex-border-strong) !important;
}

body[data-ui-theme="dark"] .account-modal-header,
body[data-ui-theme="dark"] .billing-modal-header,
body[data-ui-theme="dark"] .master-pages-header,
body[data-ui-theme="dark"] .master-pages-actions,
body[data-ui-theme="dark"] .billing-history-table th,
body[data-ui-theme="dark"] .billing-history-table td {
  border-color: var(--codex-border) !important;
}

body[data-ui-theme="dark"] .account-modal-header h3,
body[data-ui-theme="dark"] .billing-modal-header h3,
body[data-ui-theme="dark"] .master-pages-header h3,
body[data-ui-theme="dark"] .terms-content h4,
body[data-ui-theme="dark"] .billing-summary strong,
body[data-ui-theme="dark"] .billing-history-table td,
body[data-ui-theme="dark"] .master-page-row strong {
  color: var(--codex-text) !important;
}

body[data-ui-theme="dark"] .account-modal-header p,
body[data-ui-theme="dark"] .billing-modal-header p,
body[data-ui-theme="dark"] .master-pages-header p,
body[data-ui-theme="dark"] .account-field span,
body[data-ui-theme="dark"] .billing-summary span,
body[data-ui-theme="dark"] .billing-history-table th,
body[data-ui-theme="dark"] .master-page-row small,
body[data-ui-theme="dark"] .master-pages-empty {
  color: var(--codex-text-muted) !important;
}

body[data-ui-theme="dark"] .inline-terms-btn {
  color: #93c5fd !important;
}

body[data-ui-theme="dark"] .account-field input,
body[data-ui-theme="dark"] .billing-summary div,
body[data-ui-theme="dark"] .billing-history-table,
body[data-ui-theme="dark"] .billing-history-table th,
body[data-ui-theme="dark"] .account-modal-close,
body[data-ui-theme="dark"] .billing-modal-close,
body[data-ui-theme="dark"] .master-pages-close,
body[data-ui-theme="dark"] .master-page-row,
body[data-ui-theme="dark"] .master-pages-empty,
body[data-ui-theme="dark"] .master-pages-actions button {
  background: var(--codex-surface-raised) !important;
  color: var(--codex-text) !important;
  border-color: var(--codex-border-strong) !important;
}

body[data-ui-theme="dark"] .master-page-row.is-active,
body[data-ui-theme="dark"] .master-page-row:hover {
  background: #123040 !important;
  border-color: #38bdf8 !important;
}

body[data-ui-theme="dark"] .account-modal-message,
body[data-ui-theme="dark"] .billing-modal-message {
  background: #1f2937 !important;
  border-color: var(--codex-border-strong) !important;
  color: var(--codex-text-muted) !important;
}

body[data-ui-theme="dark"] .grid-snap-field {
  background: var(--codex-surface-raised) !important;
  color: var(--codex-text) !important;
  border-color: var(--codex-border-strong) !important;
}

body[data-ui-theme="dark"] .grid-snap-field input {
  min-height: 18px !important;
  padding: 0 6px !important;
  background: var(--codex-bg) !important;
  color: var(--codex-text) !important;
  border: 1px solid #5a5a5a !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}

body[data-ui-theme="dark"] .grid-snap-field input:focus {
  border-color: #6f6f6f !important;
  outline: none !important;
}

body[data-ui-theme="dark"] .grid-snap-field span:last-child {
  color: var(--codex-text-muted) !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color {
  background: var(--codex-surface-raised) !important;
  color: var(--codex-text) !important;
  border-color: var(--codex-border-strong) !important;
}

body[data-ui-theme="dark"] .shape-flyout::before {
  background: var(--codex-surface) !important;
  border-color: var(--codex-border) !important;
}

body[data-ui-theme="dark"] .shape-flyout-title,
body[data-ui-theme="dark"] .shape-flyout-section-title,
body[data-ui-theme="dark"] .shape-choice-label {
  color: #ffffff !important;
}

body[data-ui-theme="dark"] .shape-flyout-subtitle {
  color: #f2f2f2 !important;
}

body[data-ui-theme="dark"] .shape-flyout-section-count {
  background: #2b2b2b !important;
  color: #ffffff !important;
  border: 1px solid var(--codex-border-strong) !important;
}

body[data-ui-theme="dark"] .shape-choice-preview rect {
  fill: #242424;
}

body[data-ui-theme="dark"] .shape-choice-preview path[fill="#ffffff"] {
  fill: #f8fafc;
  stroke: #ffffff;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field input,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field select,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color input[type="color"] {
  background: var(--codex-bg) !important;
  color: var(--codex-text) !important;
  border: 1px solid #5a5a5a !important;
  box-shadow: none !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field input[type="color"],
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color input[type="color"] {
  padding: 2px !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field input[type="color"]::-webkit-color-swatch-wrapper,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0 !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field input[type="color"]::-webkit-color-swatch,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color input[type="color"]::-webkit-color-swatch,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field input[type="color"]::-moz-color-swatch,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color input[type="color"]::-moz-color-swatch {
  border: 1px solid #5a5a5a !important;
  border-radius: 4px !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field input:focus,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-field select:focus,
body[data-ui-theme="dark"] .publisher-text-ribbon .mini-inline-color input[type="color"]:focus {
  border-color: #6f6f6f !important;
  outline: none !important;
}

body[data-ui-theme="dark"] .font-family-picker-panel {
  background: var(--codex-surface);
  border-color: var(--codex-border-strong);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

body[data-ui-theme="dark"] .font-family-picker-search {
  background: var(--codex-surface-raised);
  color: var(--codex-text);
  border-color: var(--codex-border-strong);
}

body[data-ui-theme="dark"] .font-family-picker-section {
  background: var(--codex-surface-raised);
  color: var(--codex-text-muted);
}

body[data-ui-theme="dark"] .font-family-picker-option {
  color: var(--codex-text);
}

body[data-ui-theme="dark"] .font-family-picker-option:hover,
body[data-ui-theme="dark"] .font-family-picker-option:focus-visible,
body[data-ui-theme="dark"] .font-family-picker-option.is-selected {
  background: var(--codex-surface-active);
}

body[data-ui-theme="dark"] .topbar button:hover,
body[data-ui-theme="dark"] .topbar button:focus-visible,
body[data-ui-theme="dark"] .publisher-text-ribbon button:hover,
body[data-ui-theme="dark"] .publisher-text-ribbon button:focus-visible,
body[data-ui-theme="dark"] .sidebar button:hover,
body[data-ui-theme="dark"] .sidebar button:focus-visible {
  background: var(--codex-surface-hover) !important;
  border-color: #5a5a5a !important;
}

body[data-ui-theme="dark"] .topbar #topbarThemeBtn.is-dark-active {
  background: var(--codex-surface-active) !important;
  color: var(--codex-text) !important;
  border-color: #5a5a5a !important;
}

body[data-ui-theme="dark"] .topbar .menu-bar-btn,
body[data-ui-theme="dark"] .topbar .menu-bar-btn:hover,
body[data-ui-theme="dark"] .topbar .menu-bar-btn:focus-visible,
body[data-ui-theme="dark"] .topbar .menu-group.is-open .menu-bar-btn {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--codex-text) !important;
}

body[data-ui-theme="dark"] .topbar .menu-bar-btn:hover::after,
body[data-ui-theme="dark"] .topbar .menu-bar-btn:focus-visible::after,
body[data-ui-theme="dark"] .topbar .menu-group.is-open .menu-bar-btn::after {
  background: #858585 !important;
}

body[data-ui-theme="dark"] .topbar .menu-bar-btn.is-ribbon-active {
  background: transparent !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

body[data-ui-theme="dark"] .topbar .menu-bar-btn.is-ribbon-active::after {
  background: #ffffff !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .ribbon-group,
body[data-ui-theme="dark"] .shape-flyout-section,
body[data-ui-theme="dark"] .brand,
body[data-ui-theme="dark"] .side-card,
body[data-ui-theme="dark"] .sidebar-panel,
body[data-ui-theme="dark"] .sidebar-object-card {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .ribbon-title {
  border-top-color: var(--codex-border) !important;
  color: var(--codex-text-muted) !important;
}

body[data-ui-theme="dark"] .publisher-text-ribbon .ribbon-check-btn.is-checked,
body[data-ui-theme="dark"] .publisher-text-ribbon .ribbon-toggle-btn.is-checked {
  background: var(--codex-surface-active) !important;
  border-color: #5a5a5a !important;
  color: var(--codex-text) !important;
}

body[data-ui-theme="dark"] .page-surface,
body[data-ui-theme="dark"] .page-svg,
body[data-ui-theme="dark"] .overlay {
  background-color: inherit;
}
