:root {
  color-scheme: light;
  --bg: #eef7f8;
  --panel: #ffffff;
  --ink: #17313d;
  --muted: #607680;
  --line: #c9dce0;
  --accent: #1595a5;
  --accent-dark: #0d6473;
  --mint: #55d6b5;
  --soft-mint: #dff7f0;
  --soft-blue: #e3f3fb;
  --danger: #a64235;
  --shadow: 0 18px 50px rgba(15, 85, 105, 0.14);
  --cursor-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23111111' stroke='%23ffffff' stroke-width='1.4' stroke-linejoin='round' d='M4 2.5 18.5 14 12 15.2l3.7 6.3-2.9 1.7-3.7-6.4L4.3 22z'/%3E%3C/svg%3E") 4 2, auto;
  --cursor-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23111111' stroke='%23ffffff' stroke-width='1.4' stroke-linejoin='round' d='M4 2.5 18.5 14 12 15.2l3.7 6.3-2.9 1.7-3.7-6.4L4.3 22z'/%3E%3C/svg%3E") 4 2, pointer;
  --cursor-crosshair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Cpath stroke='%23ffffff' stroke-width='6' stroke-linecap='square' d='M16 4v24M4 16h24'/%3E%3Cpath stroke='%23111111' stroke-width='2' stroke-linecap='square' d='M16 4v24M4 16h24'/%3E%3Crect x='15' y='15' width='2' height='2' fill='%23111111'/%3E%3C/svg%3E") 16 16, crosshair;
  --cursor-pen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'%3E%3Cpath fill='%23ffffff' stroke='%23111111' stroke-width='1.4' stroke-linejoin='round' d='M17.8 3.5 21.5 7.2 8.7 20H4.6v-4.1z'/%3E%3Cpath stroke='%23111111' stroke-width='1.6' stroke-linecap='round' d='M15.4 5.9 19.1 9.6M5 20.5h15'/%3E%3C/svg%3E") 4 21, crosshair;
  --cursor-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'%3E%3Cpath stroke='%23ffffff' stroke-width='3' stroke-linecap='round' d='M12.5 3v19M3 12.5h19'/%3E%3Cpath stroke='%23111111' stroke-width='1.6' stroke-linecap='round' d='M12.5 3v19M3 12.5h19'/%3E%3Cpath fill='%23111111' d='M16 5h4v4h-2.4V7.4H16zM5 16h2.4v1.6H9V20H5z'/%3E%3C/svg%3E") 12 12, copy;
  --cursor-move: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'%3E%3Cpath stroke='%23ffffff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round' d='M12.5 3v19M3 12.5h19m-9.5-9.5-3 3m3-3 3 3m-3 16 3-3m-3 3-3-3M3 12.5l3-3m-3 3 3 3m16-3-3-3m3 3-3 3'/%3E%3Cpath stroke='%23111111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M12.5 3v19M3 12.5h19m-9.5-9.5-3 3m3-3 3 3m-3 16 3-3m-3 3-3-3M3 12.5l3-3m-3 3 3 3m16-3-3-3m3 3-3 3'/%3E%3C/svg%3E") 12 12, move;
  --cursor-resize: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'%3E%3Cpath stroke='%23ffffff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round' d='M7 7 18 18M7 7h6M7 7v6M18 18h-6M18 18v-6'/%3E%3Cpath stroke='%23111111' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' d='M7 7 18 18M7 7h6M7 7v6M18 18h-6M18 18v-6'/%3E%3C/svg%3E") 12 12, nwse-resize;
  --cursor-rotate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round' d='M18.5 8.2A7 7 0 1 0 20 15m-1.5-6.8V4.5H22'/%3E%3Cpath fill='none' stroke='%23111111' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' d='M18.5 8.2A7 7 0 1 0 20 15m-1.5-6.8V4.5H22'/%3E%3C/svg%3E") 12 12, grab;
  --mobile-top-offset: 154px;
  --mobile-bottom-offset: 86px;
  --mobile-keyboard-offset: 0px;
  --mobile-toolbar-bottom: 86px;
  --mobile-toolbar-height: 92px;
}

@font-face {
  font-family: "Arimo";
  src: url("fonts/Arimo-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Arimo";
  src: url("fonts/Arimo-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Carlito";
  src: url("fonts/Carlito-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Carlito";
  src: url("fonts/Carlito-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Caladea";
  src: url("fonts/Caladea-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Caladea";
  src: url("fonts/Caladea-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tinos";
  src: url("fonts/Tinos-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tinos";
  src: url("fonts/Tinos-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cousine";
  src: url("fonts/Cousine-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cousine";
  src: url("fonts/Cousine-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif";
  src: url("fonts/NotoSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif";
  src: url("fonts/NotoSerif-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Mono";
  src: url("fonts/NotoSansMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Mono";
  src: url("fonts/NotoSansMono-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("fonts/Lato-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lato";
  src: url("fonts/Lato-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Sans";
  src: url("fonts/FiraSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fira Sans";
  src: url("fonts/FiraSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Crimson Text";
  src: url("fonts/CrimsonText-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Crimson Text";
  src: url("fonts/CrimsonText-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(50, 145, 210, 0.16), rgba(96, 220, 184, 0.2) 42%, rgba(255, 255, 255, 0.45)),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  cursor: var(--cursor-arrow);
}

* {
  caret-color: #111;
}

button,
input {
  font: inherit;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.topbar,
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.bottombar {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.consistency-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(21, 149, 165, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
  padding: 0 12px;
  font-weight: 820;
  cursor: var(--cursor-pointer);
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(15, 85, 105, 0.08);
}

.consistency-button:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 149, 165, 0.58);
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.92), rgba(223, 247, 240, 0.9));
}

.consistency-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.consistency-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-dark);
  color: #fff;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 820;
}

.download-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 12px;
  margin-left: auto;
  min-width: 0;
}

#downloadConsent {
	transform: scale(1.3);
	margin-right: 10px;
}

.download-consent {
  max-width: 430px;
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.download-consent.needs-attention {
  animation: consentNudge 0.9s ease;
  box-shadow: 0 0 0 4px rgba(21, 149, 165, 0.16);
}

.download-consent input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: var(--cursor-pointer);
}

.download-consent span {
  min-width: 0;
}

.download-consent a {
  color: var(--accent-dark);
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.download-consent a:hover {
  text-decoration: underline;
}

@keyframes consentNudge {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-3px);
  }

  55% {
    transform: translateX(3px);
  }
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar p,
.empty-state p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.brand {
  min-width: 260px;
  display: inline-flex;
  align-items: center;
  gap: 13px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: contain;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.brand-pdf-mark {
  display: inline-flex;
  position: relative;
  align-items: center;
  min-height: 21px;
  padding: 1px 8px 2px;
  border-radius: 999px 999px 999px 999px;
  background: linear-gradient(135deg, #1292e0 0%, #04ccab 100%);
  color: #fff;
  font-size: 0.65em;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  top: -5px;
}

.file-button,
.download-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent) 52%, var(--mint));
  color: #fff;
  padding: 0 16px;
  font-weight: 740;
  cursor: var(--cursor-pointer);
  white-space: nowrap;
}

.download-price {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 13px;
  font-weight: 820;
}

.download-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.file-button:hover,
.download-button:hover,
.top-icon-button:hover {
  transform: translateY(-1px);
}

.secondary-file-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
}

.join-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(21, 149, 165, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.94), rgba(223, 247, 240, 0.92));
  color: var(--accent-dark);
  padding: 0 11px;
  font-weight: 820;
  cursor: var(--cursor-pointer);
  white-space: nowrap;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.join-button:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 149, 165, 0.58);
}

.join-button.member-active {
  background: #fff;
  border-color: rgba(85, 214, 181, 0.68);
}

.join-button.subscriber-active {
  background: linear-gradient(135deg, #17313d, #0d6473 55%, #1595a5);
  border-color: rgba(85, 214, 181, 0.62);
  color: #fff;
}

.join-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.top-icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent-dark);
  cursor: var(--cursor-pointer);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.top-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.top-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-button:disabled,
.download-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  overflow: hidden;
}

.page-panel {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(227, 243, 251, 0.88), rgba(223, 247, 240, 0.86));
  padding: 14px;
  overflow: hidden;
}

.page-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-title {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.page-thumbnail-toggle {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(13, 100, 115, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  cursor: var(--cursor-pointer);
}

.page-thumbnail-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.page-thumbnail-toggle:hover,
.page-thumbnail-toggle:focus-visible,
.page-thumbnail-toggle.active {
  border-color: rgba(21, 149, 165, 0.5);
  background: var(--soft-mint);
  outline: none;
}

.page-thumbnail-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.page-list {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 12px;
}

.page-chip {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  cursor: var(--cursor-pointer);
}

.page-thumbnail-frame {
  display: none;
  width: 100%;
  height: 116px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(13, 100, 115, 0.12);
  border-radius: 6px;
  background: #f8fbfb;
}

.page-list.show-thumbnails .page-thumbnail-frame {
  display: grid;
}

.page-thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-list.show-thumbnails .page-chip {
  padding: 8px;
  text-align: center;
}

.page-chip-label {
  min-width: 0;
}

.page-chip.active {
  border-color: var(--accent);
  background: #fff;
  box-shadow:
    inset 3px 0 0 var(--mint),
    0 6px 16px rgba(21, 149, 165, 0.11);
}

.page-context-menu,
.pdf-context-menu {
  position: fixed;
  z-index: 3000;
  min-width: 146px;
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.pdf-context-menu {
  min-width: 188px;
}

.page-context-menu button,
.pdf-context-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 0 10px;
  cursor: var(--cursor-pointer);
}

.pdf-context-menu button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.pdf-context-menu button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.pdf-context-menu button span {
  min-width: 0;
}

.page-context-menu button:hover:not(:disabled),
.pdf-context-menu button:hover:not(:disabled) {
  background: var(--soft-mint);
  color: var(--accent-dark);
}

.page-context-menu button:disabled,
.pdf-context-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.page-actions {
  position: sticky;
  bottom: 0;
  margin: auto -2px -2px;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(223, 247, 240, 0), rgba(223, 247, 240, 0.96) 34%);
}

.add-page-button {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(13, 100, 115, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent) 54%, var(--mint));
  color: #fff;
  font-weight: 820;
  cursor: var(--cursor-pointer);
  box-shadow: 0 10px 24px rgba(13, 100, 115, 0.16);
}

.add-page-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.add-page-button:hover {
  transform: translateY(-1px);
}

.canvas-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: auto;
  padding: 28px;
  background: rgba(255, 255, 255, 0.22);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.canvas-panel.interaction-locked {
  overscroll-behavior: none;
  touch-action: none;
  -webkit-overflow-scrolling: auto;
}

.mobile-zoom-controls {
  display: none;
}

.mobile-zoom-controls button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: #edf7f8;
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 820;
  cursor: var(--cursor-pointer);
}

.mobile-zoom-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.mobile-zoom-controls span {
  min-width: 44px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 820;
  text-align: center;
}

.empty-state {
  width: min(430px, 100%);
  margin: 15vh auto;
  display: block;
  border: 0;
  appearance: none;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: center;
  cursor: var(--cursor-pointer);
}

.empty-state:hover .empty-mark,
.empty-state:focus-visible .empty-mark {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.empty-state:focus-visible {
  outline: 3px solid rgba(85, 214, 181, 0.45);
  outline-offset: 8px;
  border-radius: 8px;
}

.empty-mark {
  width: 96px;
  height: 124px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 820;
  box-shadow: var(--shadow);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease;
}

.page-stage {
  display: grid;
  justify-content: center;
  gap: 28px;
}

.page-stage.pinch-preview {
  will-change: transform;
}

.pdf-page {
  position: relative;
  width: max-content;
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(201, 220, 224, 0.8);
  touch-action: none;
}

.pdf-page canvas {
  display: block;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  cursor: var(--cursor-crosshair);
  touch-action: none;
}

.annotation-layer.drag-selecting {
  cursor: var(--cursor-copy);
}

.annotation-layer.box-marquee-selecting {
  cursor: var(--cursor-copy);
}

body.freehand-mode .annotation-layer {
  cursor: var(--cursor-pen);
}

body.freehand-mode .annotation-layer .text-box {
  pointer-events: none;
}

body.freehand-drawing .annotation-layer .text-box {
  border-color: transparent !important;
  box-shadow: none !important;
}

body.freehand-drawing .box-toolbar,
body.freehand-drawing .resize-handle,
body.freehand-drawing .rotate-handle {
  display: none !important;
}

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

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

.drag-field-preview-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: 3px;
  background: rgba(85, 214, 181, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.82),
    0 0 0 1px rgba(13, 100, 115, 0.12);
}

.box-selection-marquee {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 5px;
  background: rgba(85, 214, 181, 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 8px 24px rgba(13, 100, 115, 0.12);
}

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

.alignment-guide-line {
  position: absolute;
  pointer-events: none;
}

.alignment-guide-line.vertical {
  top: 0;
  width: 0;
  border-left: 1.5px dashed rgba(13, 100, 115, 0.78);
  transform: translateX(-0.5px);
}

.alignment-guide-line.horizontal {
  left: 0;
  height: 0;
  border-top: 1.5px dashed rgba(13, 100, 115, 0.78);
  transform: translateY(-0.5px);
}

.alignment-distance-label {
  position: absolute;
  z-index: 2;
  min-width: 30px;
  padding: 2px 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: rgba(13, 100, 115, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 840;
  line-height: 1.2;
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(15, 49, 61, 0.18);
  white-space: nowrap;
}

.text-box {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  min-width: 1px;
  min-height: 1px;
  border: 2px solid transparent;
  background: transparent;
  outline: 0;
  touch-action: manipulation;
  transform-origin: center;
}

.text-box.is-rotated {
  transform: rotate(var(--box-rotation, 0deg));
}

.text-box.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.23);
}

.text-box.marquee-selected {
  border-color: rgba(13, 100, 115, 0.78);
  box-shadow:
    0 0 0 2px rgba(85, 214, 181, 0.22),
    0 0 0 5px rgba(13, 100, 115, 0.08);
}

.text-box.primary-selected {
  z-index: 30 !important;
}

.text-box.alignment-guide-target {
  border-color: rgba(13, 100, 115, 0.62);
  box-shadow:
    0 0 0 2px rgba(85, 214, 181, 0.18),
    0 0 0 5px rgba(13, 100, 115, 0.08);
}

.text-box.find-replace-scope {
  box-shadow: 0 0 0 2px rgba(21, 149, 165, 0.14);
}

.text-box.compact-field.selected {
  box-shadow: 0 0 0 1px rgba(85, 214, 181, 0.26);
}

.text-box.compact-field {
  border-width: 1px;
}

.editable {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 5px 10px;
  outline: none;
  caret-color: #111;
  overflow: hidden;
  align-content: start;
  white-space: pre-wrap;
  word-break: break-word;
  color: #111;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: left;
}

.editable-inline-flow {
  display: inline;
  min-width: 0;
  max-width: 100%;
  white-space: inherit;
  word-break: inherit;
}

.inline-format-toolbar {
  position: fixed;
  z-index: 160;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(13, 100, 115, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(19, 68, 80, 0.18);
}

.inline-format-toolbar[hidden] {
  display: none;
}

.inline-format-toolbar button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 800 15px/1 var(--font);
  cursor: pointer;
}

.inline-format-toolbar button:hover,
.inline-format-toolbar button:focus-visible,
.inline-format-toolbar button.active {
  background: rgba(85, 214, 181, 0.22);
  color: var(--accent-dark);
  outline: none;
}

.inline-format-toolbar button.redact-command {
  color: #111;
}

.editable-redaction {
  display: inline-block;
  min-width: 8px;
  min-height: 8px;
  background: #000;
  color: transparent;
  vertical-align: -0.12em;
  user-select: none;
  white-space: nowrap;
}

.text-box.redacted-box .editable {
  background: #000 !important;
  color: #000 !important;
  caret-color: transparent;
  user-select: none;
}

.text-box.redacted-box .editable::before {
  display: none !important;
}

.answer-suggestion-list {
  position: fixed;
  z-index: 170;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 190px;
  padding: 4px;
  border: 1px solid rgba(13, 100, 115, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(19, 68, 80, 0.18);
  overflow-y: auto;
}

.answer-suggestion-list[hidden] {
  display: none;
}

.answer-suggestion-option {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 6px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 700 13px/1.25 var(--font);
  text-align: left;
  cursor: var(--cursor-pointer);
}

.answer-suggestion-option:hover,
.answer-suggestion-option:focus-visible,
.answer-suggestion-option.active {
  background: rgba(85, 214, 181, 0.22);
  color: var(--accent-dark);
  outline: none;
}

.answer-suggestion-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-box.compact-field .editable:empty::before {
  content: "";
}

.editable:empty::before {
  content: "Type";
  color: rgba(31, 37, 40, 0.35);
}

.text-box.has-background-fill .editable:empty::before {
  content: "";
}

.text-box.checkmark-box .editable {
  display: grid;
  place-items: center;
  padding: 3px;
  font-size: 22px;
  line-height: 1;
  text-align: center;
  overflow: visible;
}

.text-box.checkmark-box.compact-field .editable {
  padding: 0;
}

.text-box.checkmark-box .editable:empty::before {
  content: "";
}

.text-box.segmented-field .editable {
  position: relative;
  padding: 0;
  overflow: visible;
}

.segment-input {
  position: absolute;
  z-index: 2;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  caret-color: var(--accent-dark);
  outline: none;
  padding: 0;
  text-align: center;
  line-height: 1;
  font: inherit;
  font-size: inherit;
  box-sizing: border-box;
  touch-action: manipulation;
}

.segment-input:focus {
  background: rgba(85, 214, 181, 0.12);
  box-shadow: inset 0 0 0 1px rgba(21, 149, 165, 0.38);
}

.segment-input::selection {
  background: rgba(85, 214, 181, 0.34);
}

.text-box.image-box .editable {
  padding: 0;
  overflow: hidden;
}

.text-box.signature-box .editable {
  padding: 0;
  overflow: hidden;
  touch-action: none;
}

.text-box.line-box .editable {
  position: relative;
  display: block;
  padding: 0;
  overflow: visible;
}

.text-box.line-box .line-fill {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  width: 100%;
  height: var(--line-thickness, 2px);
  min-height: 2px;
  border-radius: 999px;
  background: currentColor;
  pointer-events: none;
  transform: translateY(-50%);
}

.text-box.image-box .editable:empty::before,
.text-box.signature-box .editable:empty::before {
  content: "";
}

.box-image {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: var(--cursor-crosshair);
  touch-action: none;
}

.signature-toolbar-actions,
.group-input-toolbar-actions {
  position: absolute;
  left: 6px;
  top: calc(100% - 1px);
  z-index: 3;
  width: max-content;
  display: none;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.text-box.signature-box.primary-selected .signature-toolbar-actions,
.text-box.group-input-actions-visible.primary-selected .group-input-toolbar-actions {
  display: flex;
}

.signature-action-button,
.group-input-action-button {
  position: relative;
  z-index: 1;
  width: 31px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(29, 163, 254, 0.34);
  border-right: 0;
  background: linear-gradient(180deg, #ffffff, #effafa);
  color: var(--accent-dark);
  cursor: pointer;
  font: 800 16px/1 Arial, sans-serif;
  overflow: visible;
}

.signature-action-button:first-child,
.group-input-action-button:first-child {
  border-radius: 0 0 0 7px;
}

.signature-action-button:last-child,
.group-input-action-button:last-child {
  border-right: 1px solid rgba(29, 163, 254, 0.34);
  border-radius: 0 0 7px 0;
}

.signature-action-button:hover,
.signature-action-button:focus-visible,
.group-input-action-button:hover,
.group-input-action-button:focus-visible,
.group-input-action-button.active {
  background: #e5f8f5;
  color: var(--ink);
  outline: none;
}

.group-input-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.signature-merge-button {
  display: none;
}

.text-box.signature-box.primary-selected:not(.can-merge-drawings) .signature-convert-button {
  border-right: 1px solid rgba(29, 163, 254, 0.34);
  border-radius: 0 0 7px 0;
}

.text-box.signature-box.primary-selected.can-merge-drawings .signature-merge-button {
  display: grid;
}

.signature-action-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.signature-merge-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.15;
}

.signature-action-button[data-tooltip]::before,
.signature-action-button[data-tooltip]::after {
  z-index: 120;
}

.box-toolbar {
  position: absolute;
  left: var(--toolbar-left, -2px);
  bottom: calc(100% + 32px + var(--toolbar-bottom-extra, 0px));
  z-index: 80;
  width: max-content;
  max-width: min(var(--toolbar-max-width, 760px), calc(100vw - 32px));
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 85, 105, 0.17);
  opacity: 1;
  filter: blur(0);
  transform: rotate(var(--box-counter-rotation, 0deg)) translateY(0) scale(1);
  transform-origin: left bottom;
  will-change: transform, left, bottom;
  transition:
    opacity 0.18s ease,
    filter 0.18s ease,
    left 0.22s cubic-bezier(0.2, 0.82, 0.22, 1),
    bottom 0.22s cubic-bezier(0.2, 0.82, 0.22, 1),
    transform 0.24s cubic-bezier(0.2, 0.82, 0.22, 1);
}

.text-box.toolbar-rotation-active > .box-toolbar {
  opacity: 0;
  pointer-events: none;
  filter: blur(2px);
  transform: rotate(var(--box-counter-rotation, 0deg)) translateY(8px) scale(0.985);
}

.text-box.primary-selected > .box-toolbar {
  display: flex;
}

.text-box.toolbar-typing-hidden > .box-toolbar {
  opacity: 0;
  pointer-events: none;
  filter: blur(2px);
  transform: rotate(var(--box-counter-rotation, 0deg)) translateY(8px) scale(0.985);
}

.box-toolbar [data-tooltip] {
  position: relative;
}

.box-toolbar [data-tooltip]::before,
.box-toolbar [data-tooltip]::after {
  position: absolute;
  left: 50%;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
}

.box-toolbar [data-tooltip]::before {
  content: "";
  bottom: calc(100% + 3px);
  transform: translateX(-50%) translateY(3px);
  border: 5px solid transparent;
  border-top-color: var(--ink);
}

.box-toolbar [data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 12px);
  max-width: 210px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 49, 61, 0.24);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%) translateY(5px);
}

.box-toolbar [data-tooltip]:hover::before,
.box-toolbar [data-tooltip]:hover::after,
.box-toolbar [data-tooltip]:focus-visible::before,
.box-toolbar [data-tooltip]:focus-visible::after,
.box-toolbar [data-tooltip]:focus-within::before,
.box-toolbar [data-tooltip]:focus-within::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.type-control.open .type-settings-toggle::before,
.type-control.open .type-settings-toggle::after,
.text-mode-control.open .text-mode-toggle::before,
.text-mode-control.open .text-mode-toggle::after,
.border-control.open .border-settings-toggle::before,
.border-control.open .border-settings-toggle::after,
.css-control.open .css-settings-toggle::before,
.css-control.open .css-settings-toggle::after,
.alignment-control.open .alignment-picker-toggle::before,
.alignment-control.open .alignment-picker-toggle::after,
.symbol-control:focus-within [data-tooltip]::before,
.symbol-control:focus-within [data-tooltip]::after {
  display: none;
}

.tool-button,
.alignment-picker-toggle,
.fill-picker-label {
  width: 31px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  font-weight: 780;
  cursor: var(--cursor-pointer);
}

.alignment-toolbar-group {
  height: 31px;
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
}

.alignment-control {
  position: relative;
  height: 31px;
  display: inline-grid;
}

.alignment-control.open {
  z-index: 30;
}

.alignment-picker-toggle {
  width: 45px;
  grid-template-columns: minmax(0, 1fr) 10px;
  gap: 2px;
  padding: 0 6px;
}

.vertical-align-toggle {
  width: 45px;
}

.alignment-picker-value {
  min-width: 0;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.alignment-picker-arrow {
  font-size: 9px;
  line-height: 1;
  transform: translateY(1px);
}

.symbol-control {
  height: 31px;
  display: inline-flex;
  align-items: stretch;
  border-radius: 7px;
  background: #edf7f8;
  box-shadow: inset 0 0 0 1px transparent;
}

.symbol-control .check-button {
  width: 29px;
  border-radius: 7px 0 0 7px;
  background: transparent;
}

.symbol-control .check-button.long-symbol {
  font-size: 11px;
  letter-spacing: 0;
}

.symbol-picker-label {
  position: relative;
  width: 18px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-left: 1px solid rgba(18, 105, 128, 0.12);
  border-radius: 0 7px 7px 0;
  color: var(--ink);
  cursor: var(--cursor-pointer);
}

.symbol-picker-toggle {
  width: 100%;
  height: 100%;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: var(--cursor-pointer);
  font: inherit;
  padding: 0;
}

.symbol-picker-toggle span {
  font-size: 10px;
  line-height: 1;
  transform: translateY(1px);
}

.symbol-control:hover,
.symbol-control:focus-within,
.text-mode-control:hover .text-mode-toggle,
.text-mode-control:focus-within .text-mode-toggle,
.text-mode-control.open .text-mode-toggle,
.alignment-control:hover .alignment-picker-toggle,
.alignment-control:focus-within .alignment-picker-toggle,
.alignment-control.open .alignment-picker-toggle {
  background: var(--soft-mint);
  box-shadow: inset 0 0 0 1px rgba(21, 149, 165, 0.32);
}

.text-mode-control {
  position: relative;
  display: inline-grid;
}

.text-mode-control.open {
  z-index: 30;
}

.text-mode-value {
  display: inline-grid;
  place-items: center;
}

.text-mode-value svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.text-mode-control.open .text-mode-toggle {
  border-color: var(--accent);
  background: var(--soft-mint);
  color: var(--accent-dark);
}

.fill-picker-label {
  position: relative;
  overflow: visible;
}

.text-mode-menu,
.symbol-menu,
.alignment-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: -2px;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(3, 31px);
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 85, 105, 0.18);
}

.text-mode-menu {
  grid-template-columns: repeat(3, 31px);
}

.alignment-menu {
  grid-template-columns: repeat(4, 31px);
}

.vertical-alignment-menu {
  grid-template-columns: repeat(3, 31px);
}

.box-toolbar.toolbar-near-bottom .text-mode-menu,
.box-toolbar.toolbar-near-bottom .symbol-menu {
  top: auto;
  bottom: calc(100% + 7px);
}

.box-toolbar.toolbar-near-bottom .alignment-menu {
  top: auto;
  bottom: calc(100% + 7px);
}

.text-mode-menu[hidden],
.symbol-menu[hidden],
.alignment-menu[hidden] {
  display: none;
}

.text-mode-option,
.symbol-option,
.alignment-option {
  width: 31px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  cursor: var(--cursor-pointer);
  font-size: 14px;
  font-weight: 780;
  line-height: 1;
}

.symbol-option[data-symbol="N/A"] {
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0;
}

.text-mode-option svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.vertical-alignment-menu .alignment-option {
  width: 31px;
}

.text-mode-option:hover,
.text-mode-option:focus-visible,
.text-mode-option.active,
.text-mode-option.dictating,
.symbol-option:hover,
.symbol-option:focus-visible,
.alignment-option:hover,
.alignment-option:focus-visible,
.alignment-option.active {
  border-color: var(--accent);
  background: var(--soft-mint);
  color: var(--accent-dark);
  outline: none;
}

.text-box.dictating .text-mode-toggle,
.text-box.dictating .text-mode-option[data-text-mode="dictation"] {
  border-color: #d88a10;
  background: #fff4dd;
  color: #9a5b00;
}

.tool-button svg,
.fill-picker-label svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.background-color {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  cursor: var(--cursor-pointer);
  opacity: 0;
}

.move-button {
  cursor: var(--cursor-move);
  touch-action: none;
}

.tool-button.active,
.alignment-option.active {
  border-color: var(--accent);
  background: var(--soft-mint);
  color: var(--accent-dark);
}

.tool-button.danger {
  color: var(--ink);
}

.tool-button.muted {
  color: #5e6670;
}

.tool-button.loading {
  color: var(--accent-dark);
}

.tool-button.loading svg {
  animation: spin 0.9s linear infinite;
}

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

.type-control,
.border-control,
.css-control {
  position: relative;
  display: inline-grid;
}

.type-control.open,
.border-control.open,
.css-control.open {
  z-index: 30;
}

.type-settings-toggle {
  font-size: 12px;
  letter-spacing: 0;
}

.type-control.open .type-settings-toggle,
.border-control.open .border-settings-toggle,
.css-control.open .css-settings-toggle {
  border-color: var(--accent);
  background: var(--soft-mint);
  color: var(--accent-dark);
}

.type-settings-popover,
.border-settings-popover,
.css-settings-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 25;
  width: 210px;
  max-width: calc(100vw - 32px);
  max-height: none !important;
  overflow: visible !important;
  display: none;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 85, 105, 0.2);
  transform: translateX(-50%);
}

.box-toolbar.toolbar-near-top .type-settings-popover,
.box-toolbar.toolbar-near-top .border-settings-popover,
.box-toolbar.toolbar-near-top .css-settings-popover {
  top: calc(100% + 8px);
  bottom: auto;
  max-height: none;
  overflow: visible;
}

.type-control.open .type-settings-popover,
.border-control.open .border-settings-popover,
.css-control.open .css-settings-popover {
  display: grid;
}

.type-settings-popover::after,
.border-settings-popover::after,
.css-settings-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
}

.box-toolbar.toolbar-near-top .type-settings-popover::after,
.box-toolbar.toolbar-near-top .border-settings-popover::after,
.box-toolbar.toolbar-near-top .css-settings-popover::after {
  top: -6px;
  bottom: auto;
  border: 0;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.css-settings-toggle {
  font-size: 9px;
  letter-spacing: 0;
}

.css-settings-popover {
  width: 284px;
  box-sizing: border-box;
  grid-template-rows: minmax(0, 1fr) auto;
  max-height: min(380px, var(--toolbar-popover-max-height, 380px)) !important;
  overflow: hidden !important;
}

.css-settings-scroll {
  display: grid;
  gap: 6px;
  min-height: 0;
  max-height: max(0px, calc(min(380px, var(--toolbar-popover-max-height, 380px)) - 52px));
  overflow-y: auto;
  padding-right: 2px;
}

.css-section {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(13, 100, 115, 0.12);
  border-radius: 7px;
  background: #f8fcfd;
  padding: 6px;
}

.css-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 840;
  cursor: pointer;
  list-style: none;
}

.css-section summary::-webkit-details-marker {
  display: none;
}

.css-section summary::after {
  content: "\25be";
  color: var(--accent-dark);
  font-size: 10px;
  transition: transform 0.16s ease;
}

.css-section[open] summary::after {
  transform: rotate(180deg);
}

.css-section:not([open]) {
  padding-bottom: 6px;
}

.css-value-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 4px;
}

.css-settings-popover .type-setting-row {
  grid-template-columns: minmax(0, 1fr) 132px;
}

.css-settings-popover .type-setting-row-wide {
  grid-template-columns: 1fr;
}

.css-copy-styles-button {
  min-height: 31px;
  border: 1px solid rgba(13, 100, 115, 0.18);
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  font: 800 12px/1 var(--font);
  cursor: var(--cursor-pointer);
}

.css-copy-styles-button:hover,
.css-copy-styles-button:focus-visible {
  border-color: var(--accent);
  background: var(--soft-mint);
  color: var(--accent-dark);
  outline: none;
}

.type-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
}

.type-setting-row-wide {
  grid-template-columns: 1fr;
}

.type-setting-row input,
.type-setting-row select {
  min-width: 0;
  width: 58px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fcfd;
  color: var(--ink);
  font: inherit;
  text-align: center;
  outline: none;
}

.css-value-unit input,
.css-value-unit select {
  width: 100%;
}

.css-settings-popover .type-setting-row input,
.css-settings-popover .type-setting-row select {
  width: 132px;
}

.css-settings-popover .css-value-unit input,
.css-settings-popover .css-value-unit select {
  width: 100%;
}

.css-settings-popover .type-setting-row-wide select {
  width: 100%;
}

.type-setting-row select {
  width: 100%;
  text-align: left;
}

.type-setting-row input:focus,
.type-setting-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.22);
}

.font-color,
.border-color,
.css-text-color,
.css-background-color,
.css-border-color {
  padding: 2px;
}

.resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  display: none;
  z-index: 4;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  cursor: var(--cursor-resize);
  touch-action: none;
  box-shadow: 0 2px 7px rgba(31, 37, 40, 0.2);
}

.text-box.primary-selected > .resize-handle {
  display: block;
}

.rotate-handle {
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 42px;
  height: 42px;
  display: none;
  z-index: 3;
  border-radius: 50%;
  background: transparent;
  cursor: var(--cursor-rotate);
  touch-action: none;
}

.text-box.primary-selected > .rotate-handle {
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 49, 61, 0.42);
}

.grammar-modal,
.member-modal,
.consistency-modal,
.find-replace-modal,
.select-where-modal,
.add-page-modal,
.delete-page-modal,
.save-dialog-modal,
.pdf-password-modal,
.docx-credit-modal,
.suggestion-manager-modal,
.box-selection-tip-modal {
  width: min(880px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(15, 85, 105, 0.25);
}

.add-page-modal {
  width: min(680px, 100%);
}

.delete-page-modal {
  width: min(520px, 100%);
}

.pdf-password-modal {
  width: min(480px, 100%);
}

.docx-credit-modal {
  width: min(480px, 100%);
}

.suggestion-manager-modal {
  width: min(720px, 100%);
}

.save-dialog-form,
.pdf-password-form {
  display: contents;
}

.docx-credit-body {
  padding: 18px;
}

.docx-credit-body p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.pdf-password-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.pdf-password-body label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

.pdf-password-body input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfdce3;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.pdf-password-body input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.22);
}

.save-dialog-modal {
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid rgba(106, 127, 138, 0.35);
}

.save-dialog-titlebar,
.save-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #d8e1e6;
  background: linear-gradient(180deg, #ffffff, #f6fafb);
}

.save-dialog-titlebar h2 {
  font-size: 18px;
  line-height: 1.2;
}

.save-dialog-titlebar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.save-dialog-body {
  display: block;
  background: #fff;
}

.save-dialog-main {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
}

.save-dialog-fields,
.save-password-grid {
  display: grid;
  gap: 10px;
}

.save-dialog-fields label,
.save-password-grid label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

.save-dialog-fields label,
.save-password-grid label {
  display: grid;
  gap: 6px;
}

.save-dialog-fields input,
.save-password-grid input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfdce3;
  border-radius: 5px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  outline: none;
}

.save-dialog-fields input[readonly] {
  background: #f7fafb;
}

.save-dialog-fields input:focus,
.save-password-grid input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.22);
}

.save-password-toggle {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #cfdce3;
  border-radius: 6px;
  padding: 8px 12px;
  background: #f7fbfc;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 820;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.save-password-toggle:hover,
.save-password-toggle.is-open {
  border-color: rgba(29, 163, 254, 0.5);
  background: #effaff;
  box-shadow: 0 4px 12px rgba(24, 121, 178, 0.1);
}

.save-password-toggle:active {
  transform: translateY(1px);
}

.save-password-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.save-csv-option {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

.save-csv-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.save-password-box {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid #d8e1e6;
  border-radius: 5px;
  background: #fbfdfe;
}

.save-password-box legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 820;
}

.save-password-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.save-dialog-status {
  min-height: 19px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.save-dialog-status.is-error {
  color: #9f2c3d;
  font-weight: 740;
}

.save-dialog-status.is-success {
  color: #0d6f62;
  font-weight: 740;
}

.save-dialog-status.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  display: inline-block;
  margin-right: 7px;
  border: 2px solid #cde4e8;
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.75s linear infinite;
}

.save-dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid #d8e1e6;
  border-bottom: 0;
}

.find-replace-modal {
  width: min(520px, 100%);
}

.select-where-modal {
  width: min(540px, 100%);
}

.find-replace-fields,
.select-where-fields {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.find-replace-fields label,
.select-where-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

.find-replace-fields input[type="text"],
.select-where-fields input[type="text"],
.select-where-fields select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.find-replace-fields input[type="text"]:focus,
.select-where-fields input[type="text"]:focus,
.select-where-fields select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.22);
}

.find-replace-check,
.select-where-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.select-where-fields label[hidden] {
  display: none !important;
}

.find-replace-summary,
.select-where-summary {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.find-replace-modal .modal-actions button,
.select-where-modal .modal-actions button {
  min-height: 36px;
}

.box-selection-tip-modal {
  position: relative;
  width: min(560px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 22px;
  text-align: center;
}

.box-selection-tip-modal h2 {
  max-width: 440px;
  margin: 0;
  padding: 0 28px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.22;
  letter-spacing: 0;
}

.box-selection-tip-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(13, 100, 115, 0.14);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: var(--cursor-pointer);
}

.box-selection-tip-close:hover {
  border-color: rgba(21, 149, 165, 0.46);
  background: var(--soft-blue);
}

.box-selection-tip-gif {
  width: min(100%, 420px);
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.delete-page-body {
  padding: 16px 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.member-modal {
  width: min(620px, 100%);
}

.consistency-modal {
  width: min(780px, 100%);
}

.guide-modal {
  width: min(980px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(15, 85, 105, 0.25);
}

.suggestion-manager-content {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.suggestion-manager-note {
  margin: 0;
  padding: 12px 13px;
  border: 1px solid rgba(21, 149, 165, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.74), rgba(223, 247, 240, 0.82));
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.45;
}

.suggestion-source-section,
.suggestion-paste-section,
.suggestion-source-list-section {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.suggestion-source-section {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.suggestion-source-section h3,
.suggestion-paste-section h3,
.suggestion-source-list-section h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 14px;
  line-height: 1.2;
}

.suggestion-source-section p,
.suggestion-paste-section p,
.suggestion-source-list-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.suggestion-paste-heading,
.suggestion-source-list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 230px);
  gap: 12px;
  align-items: start;
}

.suggestion-source-list-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.suggestion-paste-heading input,
.suggestion-paste-section textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}

.suggestion-paste-section textarea {
  min-height: 124px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.45;
}

.suggestion-paste-section .primary-button {
  justify-self: end;
}

.suggestion-source-empty {
  margin: 0;
  padding: 13px;
  border: 1px dashed rgba(13, 100, 115, 0.22);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--muted);
  font-size: 13px;
}

.suggestion-source-list {
  display: grid;
  gap: 8px;
}

.suggestion-source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid rgba(13, 100, 115, 0.12);
  border-radius: 8px;
  background: #f8fcfd;
}

.suggestion-source-item strong,
.suggestion-source-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-source-item strong {
  color: var(--ink);
  font-size: 13px;
}

.suggestion-source-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 18px;
  line-height: 1.2;
}

.modal-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.guide-content {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.guide-credit-summary {
  margin: 16px 18px 0;
  display: inline-flex;
  width: fit-content;
  max-width: calc(100% - 36px);
  min-height: 36px;
  align-items: center;
  border: 1px solid rgba(21, 149, 165, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.88), rgba(223, 247, 240, 0.9));
  color: var(--accent-dark);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 820;
}

.guide-section {
  display: grid;
  gap: 10px;
}

.guide-section h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.guide-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(227, 243, 251, 0.58), rgba(255, 255, 255, 0.95));
}

.guide-action-item {
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
}

.guide-cookie-button {
  min-height: 34px;
  padding: 7px 11px;
  white-space: nowrap;
}

.add-page-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 20px 6px;
}

.add-page-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcfd;
  padding: 12px;
  cursor: var(--cursor-pointer);
}

.add-page-option:has(input:checked) {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(227, 243, 251, 0.72), rgba(223, 247, 240, 0.66));
  box-shadow: inset 0 0 0 1px rgba(85, 214, 181, 0.35);
}

.add-page-option input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--accent);
}

.add-page-option strong,
.add-page-option small {
  display: block;
}

.add-page-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.add-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 20px 0;
}

.add-page-grid label,
.add-page-file-row {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.add-page-grid input,
.add-page-grid select {
  width: 100%;
  min-height: 40px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.add-page-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 0;
}

.add-page-file-row span {
  color: var(--muted);
  font-weight: 600;
}

.append-pdf-controls {
  margin-top: 2px;
}

.guide-icon {
  width: 31px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
}

.guide-icon.shortcut-icon {
  padding: 2px;
  font-size: 8px;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}

.guide-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.guide-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.guide-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.quick-tool-stack {
  position: fixed;
  top: 105px;
  right: 22px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.preview-controls,
.tools-controls,
.freehand-controls {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.freehand-options {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.freehand-option {
  position: relative;
}

.preview-button,
.tools-button,
.freehand-pen-button,
.freehand-option-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(13, 100, 115, 0.22);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(15, 85, 105, 0.2);
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.preview-button,
.tools-button,
.freehand-pen-button {
  width: 52px;
  height: 52px;
}

.preview-button svg,
.tools-button svg,
.freehand-pen-button svg,
.freehand-option-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.preview-button:hover,
.tools-button:hover,
.freehand-pen-button:hover,
.freehand-option-button:hover,
.preview-button:focus-visible,
.tools-button:focus-visible,
.freehand-pen-button:focus-visible,
.freehand-option-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(21, 149, 165, 0.45);
  box-shadow:
    0 16px 34px rgba(15, 85, 105, 0.23),
    0 0 0 3px rgba(85, 214, 181, 0.2);
}

.preview-button:disabled {
  opacity: 0.46;
  cursor: default;
  transform: none;
  box-shadow: 0 8px 22px rgba(15, 85, 105, 0.12);
}

.preview-button.is-loading {
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.96), rgba(223, 247, 240, 0.96));
  border-color: rgba(21, 149, 165, 0.4);
}

.tools-button[aria-expanded="true"] {
  border-color: rgba(21, 149, 165, 0.45);
  background: var(--soft-mint);
  color: var(--accent-dark);
}

.freehand-pen-button.active {
  background: linear-gradient(135deg, #1da3fe, #00f5bf);
  border-color: transparent;
  color: #062f3a;
  box-shadow:
    0 16px 36px rgba(0, 148, 180, 0.24),
    0 0 0 4px rgba(85, 214, 181, 0.22);
}

.tools-menu {
  position: absolute;
  top: 0;
  right: 62px;
  z-index: 98;
  width: 222px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(13, 100, 115, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 85, 105, 0.2);
  pointer-events: auto;
}

.tools-menu[hidden] {
  display: none;
}

.tool-menu-item {
  min-height: 38px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 7px 8px;
  font: 780 13px/1.2 var(--font);
  text-align: left;
  cursor: pointer;
}

.tool-menu-item:hover,
.tool-menu-item:focus-visible {
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.78), rgba(223, 247, 240, 0.78));
  color: var(--accent-dark);
  outline: none;
}

.tool-menu-item svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.freehand-popover {
  position: absolute;
  right: 56px;
  top: 50%;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 85, 105, 0.18);
  transform: translateY(-50%);
}

.freehand-popover label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
}

.freehand-popover input[type="range"] {
  width: 150px;
  accent-color: var(--accent);
}

.freehand-popover input[type="color"] {
  width: 58px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.floating-tool-panel {
  position: fixed;
  z-index: 211;
  width: min(320px, calc(100vw - 32px));
  border: 1px solid rgba(13, 100, 115, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(15, 85, 105, 0.24);
  overflow: hidden;
}

.floating-tool-panel.map-tool-panel {
  width: min(560px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 48px));
  min-width: min(340px, calc(100vw - 32px));
  min-height: 360px;
  resize: both;
  overflow: auto;
}

.floating-tool-header {
  min-height: 44px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.9), rgba(223, 247, 240, 0.9));
  cursor: move;
  user-select: none;
}

.floating-tool-header h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 14px;
  line-height: 1.2;
}

.floating-tool-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 860;
}

.floating-tool-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
}

.floating-tool-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.map-tool-panel .floating-tool-body {
  min-height: calc(100% - 45px);
  grid-template-rows: auto auto minmax(220px, 1fr) auto;
}

.calculator-display {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #f8fcfd;
  font: 800 20px/1.2 ui-monospace, Consolas, monospace;
  text-align: right;
}

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

.calculator-grid button,
.tool-use-result,
.tool-result-grid button,
.tool-date-actions button,
.tool-map-search button,
.tool-large-result {
  min-height: 36px;
  border: 1px solid rgba(13, 100, 115, 0.16);
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  font: 800 13px/1 var(--font);
  cursor: pointer;
}

.calculator-grid button:hover,
.tool-use-result:hover,
.tool-result-grid button:hover,
.tool-date-actions button:hover,
.tool-map-search button:hover,
.tool-large-result:hover {
  border-color: rgba(21, 149, 165, 0.42);
  background: var(--soft-mint);
  color: var(--accent-dark);
}

.calculator-grid .calculator-equals {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
}

.tool-field-grid {
  display: grid;
  gap: 9px;
}

.tool-field-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-field-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.tool-field-grid input,
.tool-field-grid select,
.tool-single-field input,
.tool-map-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
}

.tool-single-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.tool-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(13, 100, 115, 0.12);
  border-radius: 8px;
  background: #f8fcfd;
}

.tool-section h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1.2;
}

.tool-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.tool-result-grid button {
  display: grid;
  gap: 4px;
  min-height: 56px;
}

.tool-result-grid span {
  color: var(--muted);
  font-size: 11px;
}

.tool-result-grid strong {
  font-size: 15px;
}

.tool-date-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.tool-cleaner-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.tool-text-cleaner-input {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fcfd;
  color: var(--ink);
  padding: 9px 10px;
  font: 500 13px/1.45 var(--font);
}

.tool-cleaner-actions button {
  min-height: 34px;
  border: 1px solid rgba(13, 100, 115, 0.16);
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  font: 800 12px/1 var(--font);
  cursor: pointer;
}

.tool-cleaner-actions button:hover,
.tool-cleaner-actions button:focus-visible {
  border-color: rgba(21, 149, 165, 0.42);
  background: var(--soft-mint);
  color: var(--accent-dark);
  outline: none;
}

.tool-large-result {
  min-height: 42px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent) 58%, var(--mint));
  color: #fff;
  font-size: 16px;
}

.tool-map-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tool-map-status {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tool-map-search button {
  padding: 0 12px;
}

.tool-map-frame-wrap {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #edf7f8;
}

.tool-map-frame {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: block;
  border: 0;
}

.tool-map-canvas {
  width: 100%;
  height: 100%;
  min-height: 220px;
}

.app-toast {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 120;
  width: min(360px, calc(100vw - 36px));
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid rgba(21, 149, 165, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 46px rgba(15, 85, 105, 0.2);
}

.app-toast strong {
  font-size: 14px;
}

.app-toast span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.context-helper {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 118;
  width: min(540px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 1px solid rgba(21, 149, 165, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(15, 85, 105, 0.2);
  transform: translate(-50%, 18px) scale(0.985);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.context-helper.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  pointer-events: auto;
}

.context-helper-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(29, 163, 254, 0.16), rgba(0, 245, 191, 0.18));
  color: var(--accent-dark);
}

.context-helper-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.context-helper-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.context-helper-copy strong {
  font-size: 14px;
  line-height: 1.2;
}

.context-helper-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.context-helper-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: var(--cursor-pointer);
}

.context-helper-disable {
  min-height: 28px;
  border: 1px solid rgba(21, 149, 165, 0.22);
  border-radius: 6px;
  background: rgba(227, 243, 251, 0.64);
  color: var(--accent-dark);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 760;
  cursor: var(--cursor-pointer);
  white-space: nowrap;
}

.context-helper-disable:hover,
.context-helper-disable:focus-visible {
  border-color: rgba(21, 149, 165, 0.42);
  background: rgba(223, 247, 240, 0.82);
  outline: none;
}

.context-helper-close:hover,
.context-helper-close:focus-visible {
  background: rgba(21, 149, 165, 0.1);
  color: var(--accent-dark);
  outline: none;
}

.guide-helper-toggle {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 760;
  cursor: var(--cursor-pointer);
}

.guide-helper-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: #edf7f8;
  color: var(--ink);
  cursor: var(--cursor-pointer);
  font-size: 22px;
  line-height: 1;
}

.check-cost {
  flex: 1 1 auto;
  margin: 0 auto 0 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
}

.check-cost.is-over-limit {
  color: #b42318;
}

.consistency-power-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 18px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
}

.consistency-power-control select {
  min-width: 124px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 7px 28px 7px 9px;
}

.grammar-member-prompt {
  display: grid;
  gap: 12px;
  margin: 16px 18px;
  padding: 16px;
  border: 1px solid rgba(21, 149, 165, 0.26);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(227, 243, 251, 0.78), rgba(223, 247, 240, 0.56));
}

.grammar-member-prompt h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 16px;
  line-height: 1.25;
}

.grammar-member-prompt p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.consistency-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 18px 0;
  padding: 11px 12px;
  border: 1px solid rgba(21, 149, 165, 0.24);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  cursor: var(--cursor-pointer);
}

.consistency-consent input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
}

.consistency-consent input.needs-attention {
  animation: consentNudge 0.9s ease;
  outline: 3px solid rgba(21, 149, 165, 0.2);
  outline-offset: 3px;
}

.consistency-consent.needs-attention {
  animation: consentNudge 0.9s ease;
  box-shadow: 0 0 0 4px rgba(21, 149, 165, 0.16);
}

.consistency-results {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.consistency-summary {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.consistency-issue-list {
  display: grid;
  gap: 10px;
}

.consistency-issue {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(227, 243, 251, 0.58), rgba(255, 255, 255, 0.95));
}

.consistency-issue.checked {
  border-color: rgba(21, 149, 165, 0.18);
  background: #f8fcfd;
  opacity: 0.72;
}

.consistency-issue header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.consistency-issue-check {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  cursor: var(--cursor-pointer);
}

.consistency-issue-check input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.consistency-issue h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.consistency-issue.checked h3,
.consistency-issue.checked p {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(13, 100, 115, 0.45);
}

.consistency-issue p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.consistency-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--soft-mint);
  color: var(--accent-dark);
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.consistency-entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.consistency-entry-link {
  min-height: 28px;
  border: 1px solid rgba(21, 149, 165, 0.28);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-dark);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 780;
  cursor: var(--cursor-pointer);
}

.consistency-entry-link:hover {
  border-color: rgba(21, 149, 165, 0.58);
  background: var(--soft-mint);
}

.member-auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.member-auth-button {
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 760;
  text-align: center;
  cursor: var(--cursor-pointer);
  box-shadow: 0 8px 22px rgba(15, 85, 105, 0.08);
}

.member-auth-button:hover {
  border-color: rgba(21, 149, 165, 0.55);
  background: #f8fcfd;
}

.member-auth-button.needs-attention {
  animation: consentNudge 0.9s ease;
  border-color: rgba(21, 149, 165, 0.78);
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.96), rgba(223, 247, 240, 0.96));
  box-shadow: 0 0 0 4px rgba(21, 149, 165, 0.16);
}

.member-auth-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.member-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.member-notice {
  margin: 16px 18px 0;
  padding: 12px 14px;
  border: 1px solid rgba(29, 163, 254, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.82), rgba(223, 247, 240, 0.84));
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.member-plan-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid rgba(21, 149, 165, 0.16);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 14px 34px rgba(15, 85, 105, 0.08);
}

.member-plan-card.subscriber-plan-card {
  border-color: rgba(85, 214, 181, 0.45);
  background:
    linear-gradient(135deg, rgba(227, 243, 251, 0.62), rgba(223, 247, 240, 0.78)),
    #fff;
}

.member-plan-card.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.member-plan-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.member-plan-heading h3,
.member-plan-card h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 17px;
  line-height: 1.2;
}

.member-plan-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.member-plan-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.member-plan-card li {
  position: relative;
  padding-left: 20px;
}

.member-plan-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.48em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--mint));
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.14);
}

.member-plan-pill,
.member-plan-price {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(13, 100, 115, 0.14);
  font-size: 12px;
  font-weight: 860;
  white-space: nowrap;
}

.member-plan-price {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-color: rgba(255, 255, 255, 0.42);
}

.subscriber-auth-button {
  border-color: rgba(13, 100, 115, 0.28);
  background: linear-gradient(135deg, #17313d, #0d6473 55%, #1595a5);
  color: #fff;
}

.subscriber-auth-button:hover {
  background: linear-gradient(135deg, #102833, #0d6473 55%, #1595a5);
}

.member-upgrade-actions {
  padding: 0 18px 18px;
}

.member-credit-topup {
  padding: 0 18px 18px;
}

.credit-topup-card {
  gap: 12px;
  box-shadow: none;
}

.credit-topup-controls {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(82px, auto) auto;
  gap: 10px;
  align-items: end;
}

.credit-topup-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.credit-topup-controls input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfdce3;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.credit-topup-controls input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(85, 214, 181, 0.2);
}

.credit-price-box {
  align-self: center;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(13, 100, 115, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(227, 243, 251, 0.78), rgba(223, 247, 240, 0.78));
  color: var(--accent-dark);
  padding: 0 12px;
  font-size: 15px;
  font-weight: 860;
  white-space: nowrap;
}

.member-content {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  align-items: start;
}

.member-content h3 {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 18px;
  line-height: 1.25;
}

.member-content p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.member-badge {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--soft-blue), var(--soft-mint));
  color: var(--accent-dark);
}

.member-badge svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.member-modal-actions {
  padding: 0 18px 18px;
}

.member-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 18px 18px;
}

.grammar-status-message {
  margin: 16px 18px 0;
  padding: 12px 14px;
  border: 1px solid rgba(29, 163, 254, 0.2);
  border-radius: 8px;
  background: #f3fbfd;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.grammar-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 18px;
}

.grammar-comparison section {
  min-width: 0;
}

.grammar-comparison h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.grammar-comparison pre {
  min-height: 170px;
  max-height: 330px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcfd;
  color: var(--ink);
  font: 14px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.grammar-loading {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 34px 18px 38px;
}

.grammar-loading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid #d7edf0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 720;
  cursor: var(--cursor-pointer);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent) 58%, var(--mint));
  color: #fff;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.primary-button:disabled {
  background: #cfdce0;
  color: #5c6970;
}

.danger-button {
  background: linear-gradient(135deg, #0d6473, #1595a5);
  color: #fff;
}

.secondary-button {
  background: #edf7f8;
  color: var(--ink);
}

.danger-secondary-button {
  color: #9f2c3d;
  border: 1px solid rgba(159, 44, 61, 0.28);
}

.danger-secondary-button:hover {
  background: #fff0f2;
}

@media (max-width: 760px) {
  .save-password-grid {
    grid-template-columns: 1fr;
  }

  .save-dialog-modal {
    max-height: calc(100vh - 24px);
    overflow: auto;
  }

  .topbar,
  .bottombar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    min-width: 0;
    gap: 9px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  h1 {
    font-size: 18px;
  }

  .brand-pdf-mark {
    min-height: 18px;
    padding: 1px 6px;
  }

  .topbar p,
  .empty-state p {
    font-size: 12px;
  }

  .top-actions {
    gap: 6px;
    justify-content: flex-start;
  }

  .file-button,
  .download-button,
  .join-button,
  .consistency-button {
    min-height: 34px;
    gap: 6px;
    padding: 0 10px;
    font-size: 13px;
  }

  .top-icon-button {
    width: 32px;
    height: 32px;
  }

  .top-icon-button svg,
  .join-button svg,
  .consistency-button svg,
  .download-icon {
    width: 16px;
    height: 16px;
  }

  .consistency-button {
    width: 100%;
  }

  .download-price {
    min-height: 20px;
    padding: 0 6px;
    font-size: 12px;
  }

  .download-actions {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    justify-content: space-between;
    gap: 8px;
  }

  .context-helper {
    display: none;
  }

  .quick-tool-stack {
    top: calc(var(--mobile-top-offset) + 12px);
    right: auto;
    left: 14px;
    align-items: flex-start;
  }

  .preview-controls,
  .tools-controls,
  .freehand-controls,
  .freehand-options {
    align-items: flex-start;
  }

  .tools-menu {
    right: auto;
    left: 62px;
  }

  .freehand-popover {
    right: auto;
    left: 52px;
    min-width: 158px;
  }

  .freehand-popover input[type="range"] {
    width: 128px;
  }

  .member-plan-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
  }

  .member-plan-card.compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .credit-topup-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .member-account-actions {
    justify-content: stretch;
  }

  .member-account-actions button {
    flex: 1 1 180px;
  }

  .download-consent {
    flex: 1 1 auto;
    max-width: none;
    font-size: 11px;
  }

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

  .page-panel {
    height: 78px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-panel.thumbnails-visible {
    height: 156px;
  }

  .page-panel-header {
    margin-bottom: 0;
  }

  .page-list {
    grid-auto-flow: column;
    grid-auto-columns: 86px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
  }

  .page-list.show-thumbnails {
    grid-auto-columns: 112px;
  }

  .page-thumbnail-frame {
    height: 82px;
  }

  .panel-title {
    font-size: 11px;
  }

  .page-chip {
    padding: 7px 9px;
    font-size: 12px;
  }

  .page-actions {
    margin: 0;
    padding-top: 0;
    background: transparent;
  }

  .add-page-button {
    min-width: 96px;
    min-height: 34px;
    gap: 6px;
    font-size: 12px;
  }

  .add-page-button svg {
    width: 15px;
    height: 15px;
  }

  .canvas-panel {
    padding: 8px;
    scroll-padding:
      calc(var(--mobile-top-offset, 154px) + 8px)
      12px
      calc(var(--mobile-toolbar-bottom, 86px) + var(--mobile-toolbar-height, 92px) + 16px)
      12px;
  }

  .mobile-zoom-controls {
    position: fixed;
    top: var(--mobile-top-offset, 154px);
    right: 10px;
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(13, 100, 115, 0.16);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 26px rgba(15, 85, 105, 0.18);
  }

  .page-stage {
    width: max-content;
    min-width: 100%;
    justify-content: stretch;
    justify-items: center;
    gap: 16px;
  }

  .pdf-page {
    max-width: none;
  }

  .box-toolbar {
    position: fixed;
    left: 8px !important;
    right: 8px;
    bottom: calc(var(--mobile-toolbar-bottom, 86px) + env(safe-area-inset-bottom, 0px));
    z-index: 80;
    width: auto;
    max-width: none;
    max-height: none;
    overflow: visible;
    align-content: flex-start;
    justify-content: flex-start;
    gap: 5px;
    padding: 6px;
    touch-action: manipulation;
  }

  .box-toolbar [data-tooltip]::before,
  .box-toolbar [data-tooltip]::after {
    display: none;
  }

  .tool-button,
  .alignment-picker-toggle,
  .fill-picker-label {
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 6px;
    font-size: 13px;
  }

  .tool-button svg,
  .fill-picker-label svg {
    width: 17px;
    height: 17px;
  }

  .symbol-control,
  .symbol-picker-label,
  .symbol-picker-toggle,
  .text-mode-control,
  .alignment-control,
  .alignment-picker-toggle {
    height: 36px;
  }

  .symbol-control,
  .text-mode-control,
  .type-control,
  .border-control,
  .css-control,
  .alignment-toolbar-group {
    flex: 0 0 auto;
  }

  .alignment-toolbar-group {
    height: 36px;
    gap: 5px;
  }

  .alignment-picker-toggle {
    width: 50px;
    min-width: 50px;
  }

  .vertical-align-toggle {
    width: 50px;
    min-width: 50px;
  }

  .symbol-picker-label {
    width: 23px;
  }

  .symbol-control .check-button {
    width: 35px;
    min-width: 35px;
  }

  .text-mode-menu,
  .symbol-menu,
  .alignment-menu {
    position: fixed;
    left: auto;
    right: 8px;
    top: auto;
    bottom: calc(var(--mobile-toolbar-bottom, 86px) + var(--mobile-toolbar-height, 92px) + 8px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    grid-template-columns: repeat(3, 36px);
    gap: 5px;
    padding: 6px;
  }

  .text-mode-menu {
    grid-template-columns: repeat(3, 36px);
  }

  .box-toolbar.toolbar-near-bottom .symbol-menu,
  .box-toolbar.toolbar-near-bottom .text-mode-menu,
  .box-toolbar.toolbar-near-bottom .alignment-menu {
    top: auto;
    bottom: calc(var(--mobile-toolbar-bottom, 86px) + var(--mobile-toolbar-height, 92px) + 8px + env(safe-area-inset-bottom, 0px));
  }

  .text-mode-option,
  .symbol-option,
  .alignment-option {
    width: 36px;
    height: 36px;
  }

  .vertical-alignment-menu {
    grid-template-columns: repeat(3, 36px);
  }

  .vertical-alignment-menu .alignment-option {
    width: 36px;
  }

  .type-settings-popover,
  .border-settings-popover,
  .css-settings-popover {
    position: fixed;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(var(--mobile-toolbar-bottom, 86px) + var(--mobile-toolbar-height, 92px) + 8px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    width: auto;
    max-width: none;
    max-height: none !important;
    overflow: visible !important;
    gap: 7px;
    padding: 9px;
    transform: none;
  }

  .css-settings-popover {
    min-height: 0;
  }

  .box-toolbar.toolbar-near-top .type-settings-popover,
  .box-toolbar.toolbar-near-top .border-settings-popover,
  .box-toolbar.toolbar-near-top .css-settings-popover {
    top: auto;
    bottom: calc(var(--mobile-toolbar-bottom, 86px) + var(--mobile-toolbar-height, 92px) + 8px + env(safe-area-inset-bottom, 0px));
    max-height: none;
    overflow: visible;
  }

  .type-settings-popover::after,
  .border-settings-popover::after,
  .css-settings-popover::after {
    display: none;
  }

  .css-settings-scroll {
    max-height: 45vh;
    min-height: 0;
  }

  .type-setting-row {
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 7px;
  }

  .type-setting-row input,
  .type-setting-row select {
    width: 52px;
    height: 28px;
  }

  .css-settings-popover .type-setting-row {
    grid-template-columns: minmax(0, 1fr) 116px;
  }

  .css-settings-popover .type-setting-row input,
  .css-settings-popover .type-setting-row select {
    width: 116px;
  }

  .css-settings-popover .css-value-unit input,
  .css-settings-popover .css-value-unit select,
  .css-settings-popover .type-setting-row-wide select {
    width: 100%;
  }

  .type-setting-row-wide select {
    width: 100%;
  }

  .resize-handle {
    right: -12px;
    bottom: -12px;
    width: 24px;
    height: 24px;
  }

  .rotate-handle {
    display: none !important;
  }

  .grammar-comparison {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .grammar-modal,
  .member-modal,
  .consistency-modal,
  .add-page-modal,
  .delete-page-modal,
  .suggestion-manager-modal,
  .box-selection-tip-modal,
  .guide-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .suggestion-source-section,
  .suggestion-paste-heading,
  .suggestion-source-list-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .suggestion-paste-section .primary-button,
  .suggestion-source-section .secondary-button,
  .suggestion-source-list-header .secondary-button {
    width: 100%;
  }

  .box-selection-tip-modal {
    gap: 12px;
    padding: 18px 12px;
  }

  .box-selection-tip-modal h2 {
    padding: 0 32px;
    font-size: 18px;
  }

  .consistency-issue header {
    display: grid;
  }

  .modal-header,
  .modal-actions {
    padding: 12px;
  }

  .guide-list {
    grid-template-columns: 1fr;
  }

  .add-page-options,
  .add-page-grid {
    grid-template-columns: 1fr;
  }
}
