/* ──────────────────────────────────────────────────────────────
   Reset & base
   ────────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Google Sans', Arial, Helvetica, sans-serif;
  background: #f1f3f4;
  color: #202124;
  -webkit-font-smoothing: antialiased;
}

:root {
  --a4-page-width: 794px;
  --a4-page-height: 1123px;
  --a4-page-gap: 18px;
  --a4-page-padding-y: 72px;
  --a4-page-padding-x: 72px;
}

/* ──────────────────────────────────────────────────────────────
   Top bar
   ────────────────────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Hamburger / generic icon button in topbar */
.icon-btn {
  height: 36px;
  min-width: 36px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #444746;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: #f1f3f4;
}

.icon-btn .material-symbols-outlined {
  font-size: 22px;
}

.github-btn {
  color: #202124;
  text-decoration: none;
}

.github-btn svg {
  display: block;
}

/* Coloured Google Docs logo */
.brand-logo {
  display: flex;
  align-items: center;
  margin: 0 6px 0 2px;
  flex-shrink: 0;
}

.brand-logo svg {
  display: block;
}

/* Document title area */
.topbar-title-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  flex: 1 1 200px;
  min-width: 0;
}

.title-input {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 400;
  color: #202124;
  background: transparent;
  max-width: 440px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-input:focus {
  outline: none;
  border-color: #c2dbff;
  background: #fff;
}

/* Small icons beneath the title (star, drive, cloud) */
.title-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 2px;
}

.icon-btn-sm {
  height: 24px;
  min-width: 24px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5f6368;
}

.icon-btn-sm:hover {
  background: #f1f3f4;
}

.icon-btn-sm .material-symbols-outlined {
  font-size: 16px;
}

/* Right section of topbar */
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
}

.avatars {
  display: flex;
  align-items: center;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  margin-left: -6px;
  letter-spacing: 0;
}

.avatar-blue  { background: #1a73e8; margin-left: 0; }
.avatar-green { background: #34a853; }
.avatar-red   { background: #ea4335; }

.share-btn {
  background: #c2e7ff;
  color: #001d35;
  border: 0;
  border-radius: 20px;
  padding: 7px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.share-btn:hover {
  background: #a8d8f8;
}

.share-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ──────────────────────────────────────────────────────────────
   Menu row
   ────────────────────────────────────────────────────────────── */
.menu-row {
  background: #fff;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 36px;
  border-bottom: 1px solid #e8eaed;
  position: sticky;
  top: 64px;
  z-index: 95;
}

.menu-group {
  position: relative;
}

.menu-trigger {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: #202124;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  height: 28px;
  display: inline-flex;
  align-items: center;
}

.menu-trigger:hover,
.menu-trigger[data-open='true'] {
  background: #f1f3f4;
}

.menu-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(60, 64, 67, 0.2);
  min-width: 190px;
  padding: 6px;
  z-index: 200;
}

.menu-popup button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #202124;
}

.menu-popup button:hover {
  background: #f1f3f4;
}

.menu-icon {
  font-size: 18px !important;
  color: #5f6368;
  flex-shrink: 0;
}

.menu-divider {
  border: 0;
  border-top: 1px solid #e8eaed;
  margin: 4px 0;
}

/* ──────────────────────────────────────────────────────────────
   Main toolbar
   ────────────────────────────────────────────────────────────── */
.main-toolbar {
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  position: sticky;
  top: 100px;
  z-index: 90;
}

/* Icon-only toolbar button */
.tb-btn {
  height: 32px;
  min-width: 32px;
  border: 0;
  background: transparent;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #444746;
  padding: 0 4px;
  flex-shrink: 0;
}

.tb-btn:hover {
  background: #f1f3f4;
}

.tb-btn:active {
  background: #e8eaed;
}

.tb-btn .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* Vertical divider between toolbar groups */
.tb-divider {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: #e0e0e0;
  margin: 0 4px;
  flex-shrink: 0;
  align-self: center;
}

/* Toolbar select elements */
.tb-select {
  height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: #444746;
  padding: 0 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235f6368'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
}

.tb-select:hover {
  background-color: #f1f3f4;
}

.tb-select:focus {
  outline: 2px solid #1a73e8;
  outline-offset: -2px;
}

.tb-select-wide  { min-width: 120px; }
.tb-select-narrow { min-width: 54px; }

/* Colour-picker label wrapper */
.tb-color-label {
  --picked-color: #000000;
  position: relative;
  height: 32px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  border-radius: 4px;
  cursor: pointer;
  color: #444746;
  padding: 0 4px 0 6px;
}

.tb-color-label[data-role='text'] .material-symbols-outlined {
  color: var(--picked-color);
}

.tb-color-label[data-role='highlight'] .material-symbols-outlined {
  color: var(--picked-color);
}

.tb-color-label:hover {
  background: #f1f3f4;
}

.tb-color-label .material-symbols-outlined {
  font-size: 20px;
  pointer-events: none;
}

.tb-color-icon {
  flex-shrink: 0;
  border: 0;
  padding: 0;
  -webkit-text-stroke: 0.5px #000000;
}

.tb-color-arrow {
  width: 16px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}

.tb-color-arrow .material-symbols-outlined {
  font-size: 15px;
  color: #5f6368;
}

.tb-color-label:hover .tb-color-arrow,
.tb-color-label:focus-within .tb-color-arrow {
  background: #e8eaed;
}

.tb-color-label input[type='color'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tb-color-label:focus-within {
  outline: 2px solid #1a73e8;
  outline-offset: -2px;
}

/* Line-spacing popup (rendered at body level for correct layering) */
.line-spacing-popup {
  position: fixed;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(60, 64, 67, 0.2);
  min-width: 120px;
  padding: 6px;
  z-index: 200;
}

.line-spacing-popup button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  padding: 6px 10px;
  cursor: pointer;
  color: #202124;
}

.line-spacing-popup button:hover {
  background: #f1f3f4;
}

/* ──────────────────────────────────────────────────────────────
   Ruler
   ────────────────────────────────────────────────────────────── */
.ruler-wrap {
  display: flex;
  justify-content: center;
  padding: 6px 0 0;
  background: #f1f3f4;
}

.ruler {
  width: 794px;
  height: 18px;
  border: 1px solid #dadce0;
  border-radius: 2px;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent 24px,
    #b9bfc7 24px,
    #b9bfc7 25px
  );
  background-color: #fff;
  position: relative;
}

.ruler::before,
.ruler::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #5f6368;
}

.ruler::before { left: 44px; }
.ruler::after  { left: 116px; }

/* ──────────────────────────────────────────────────────────────
   Workspace, sidebar placeholder, page
   ────────────────────────────────────────────────────────────── */
.workspace {
  padding: 16px 0 40px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}

/* (outline styles moved to sidebar section below) */

.page-wrap {
  display: flex;
  justify-content: center;
  padding-right: 16px;
  padding-bottom: 28px;
}

.page {
  width: min(var(--a4-page-width), 92vw);
  min-height: var(--a4-page-height);
  background: #fff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 4px rgba(60, 64, 67, 0.15), 0 4px 20px rgba(60, 64, 67, 0.1);
  padding: var(--a4-page-padding-y) var(--a4-page-padding-x);
  line-height: 1.6;
  font-size: 16px;
  outline: none;
  font-family: 'Times New Roman', Times, serif;
}

/* ──────────────────────────────────────────────────────────────
   Compact layout toggle
   ────────────────────────────────────────────────────────────── */
body.compact-layout .ruler-wrap {
  display: none;
}

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

body.compact-layout .sidebar {
  display: none;
}

body.compact-layout .page-wrap {
  padding: 0 16px;
  width: auto;
  margin: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

body.compact-layout .page {
  width: 100%;
  max-width: 900px;
  border: 0;
  box-shadow: none;
  padding: 24px 40px 48px;
}

/* ──────────────────────────────────────────────────────────────
   View menu: checkable items
   ────────────────────────────────────────────────────────────── */
.menu-popup button .menu-check {
  display: inline-block;
  width: 20px;
  font-size: 14px;
  color: #1a73e8;
  font-weight: 700;
  flex-shrink: 0;
  /* hidden by default – only shown when data-checked attribute is present */
  opacity: 0;
}

.menu-popup button[data-checked] .menu-check {
  opacity: 1;
}

/* Shortcut hint aligned to the right */
.menu-shortcut {
  margin-left: auto;
  font-size: 11px;
  color: #5f6368;
  padding-left: 12px;
  white-space: nowrap;
}

/* ──────────────────────────────────────────────────────────────
   Symbols dialog
   ────────────────────────────────────────────────────────────── */
.symbols-dialog {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(32, 33, 36, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.symbols-dialog[hidden] {
  display: none;
}

.symbols-dialog-inner {
  width: min(760px, 100%);
  max-height: min(520px, 100%);
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(60, 64, 67, 0.28);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.symbols-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px;
}

.symbols-dialog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #202124;
}

.symbols-close-btn {
  height: 30px;
  min-width: 30px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  color: #5f6368;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.symbols-close-btn:hover {
  background: #f1f3f4;
}

.symbols-close-btn .material-symbols-outlined {
  font-size: 20px;
}

.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: #ffffff;
  z-index: 10000;
  font-size: 16px;
  color: #5f6368;
  font-family: 'Google Sans', sans-serif;
}

.symbols-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #d2e3fc;
  border-top-color: #1a73e8;
  animation: symbols-spin 0.8s linear infinite;
}

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

/* ──────────────────────────────────────────────────────────────
   Symbols grid
   ────────────────────────────────────────────────────────────── */
.equation-toolbar {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  max-height: 420px;
  overflow: auto;
}

.eq-group-label {
  font-size: 10px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 4px;
  white-space: nowrap;
}

.eq-btn {
  height: 28px;
  min-width: 28px;
  border: 0;
  background: transparent;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
  color: #202124;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Times New Roman', Times, serif;
}

.eq-btn:hover {
  background: #f1f3f4;
}

.eq-divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #e0e0e0;
  margin: 0 4px;
  flex-shrink: 0;
  align-self: center;
}

/* ──────────────────────────────────────────────────────────────
   Sidebar (outline + tabs)
   ────────────────────────────────────────────────────────────── */
.sidebar {
  margin-left: 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  min-height: 160px;
  box-shadow: 0 1px 4px rgba(60, 64, 67, 0.08);
  position: sticky;
  top: 148px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar.sidebar-hidden {
  display: none;
}

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

.sidebar-tabs-nav {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  flex-shrink: 0;
}

.sidebar-tab-btn {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #5f6368;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.sidebar-tab-btn .material-symbols-outlined {
  font-size: 16px;
}

.sidebar-tab-btn:hover {
  background: #f1f3f4;
  color: #202124;
}

.sidebar-tab-btn.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 600;
}

.sidebar-panel {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

/* Outline entries */
.sidebar-panel #outline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-panel #outline-list li {
  margin: 2px 0;
}

.sidebar-panel #outline-list button {
  border: 0;
  background: transparent;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #1a73e8;
  text-align: left;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-panel #outline-list button[data-level="2"] {
  padding-left: 20px;
  font-size: 12px;
}

.sidebar-panel #outline-list button[data-level="3"] {
  padding-left: 32px;
  font-size: 11px;
}

.sidebar-panel #outline-list button:hover {
  background: #f1f3f4;
}

/* Doc-tabs manager */
.doc-tabs-manager {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.add-tab-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px dashed #dadce0;
  border-radius: 6px;
  background: transparent;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #1a73e8;
  cursor: pointer;
  width: 100%;
}

.add-tab-btn:hover {
  background: #f1f3f4;
}

.add-tab-btn .material-symbols-outlined {
  font-size: 16px;
}

#doc-tabs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-tab-item {
  display: flex;
  align-items: center;
  border-radius: 4px;
  overflow: hidden;
}

.doc-tab-item.active {
  background: #e8f0fe;
}

.doc-tab-title {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #202124;
  text-align: left;
  cursor: pointer;
}

.doc-tab-item.active .doc-tab-title {
  color: #1a73e8;
  font-weight: 500;
}

.doc-tab-delete {
  border: 0;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: #5f6368;
  display: flex;
  align-items: center;
}

.doc-tab-delete:hover {
  color: #ea4335;
}

.doc-tab-delete .material-symbols-outlined {
  font-size: 14px;
}

/* ──────────────────────────────────────────────────────────────
   Ruler: hidden state
   ────────────────────────────────────────────────────────────── */
.ruler-wrap.ruler-hidden {
  display: none;
}

/* ──────────────────────────────────────────────────────────────
   Non-printing characters  (Ctrl+Shift+P)
   Approximation using CSS – shows ¶ after block elements and a
   word-spacing dot for spaces where the browser supports it.
   ────────────────────────────────────────────────────────────── */
body.show-non-printing .page p::after,
body.show-non-printing .page div::after,
body.show-non-printing .page li::after {
  content: '¶';
  color: #4285f4;
  font-size: 0.85em;
  opacity: 0.7;
  margin-left: 2px;
  pointer-events: none;
}

body.show-non-printing .page h1::after,
body.show-non-printing .page h2::after,
body.show-non-printing .page h3::after {
  content: '¶';
  color: #4285f4;
  font-size: 0.7em;
  opacity: 0.7;
  margin-left: 4px;
  vertical-align: super;
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────
   Full-screen / distraction-free mode
   ────────────────────────────────────────────────────────────── */
body.fullscreen-mode .topbar,
body.fullscreen-mode .menu-row,
body.fullscreen-mode .main-toolbar,
body.fullscreen-mode .equation-toolbar,
body.fullscreen-mode .ruler-wrap {
  display: none !important;
}

body.fullscreen-mode .workspace {
  padding-top: 0;
}

body.fullscreen-mode .sidebar {
  top: 16px;
}

body.fullscreen-mode .page {
  min-height: 100vh;
}

/* ──────────────────────────────────────────────────────────────
   Find & Replace panel
   ────────────────────────────────────────────────────────────── */
.find-replace-panel {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 200;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 12px 16px 10px;
  min-width: 360px;
  max-width: 480px;
}

.fr-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.fr-tab {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #5f6368;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.fr-tab:hover {
  background: #f1f3f4;
}

.fr-tab.active {
  background: #e8f0fe;
  color: #1a73e8;
}

.fr-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fr-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fr-input {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  color: #202124;
  outline: none;
}

.fr-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.fr-count {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
  min-width: 64px;
  text-align: right;
}

.fr-icon-btn {
  height: 28px;
  width: 28px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5f6368;
  flex-shrink: 0;
}

.fr-icon-btn:hover {
  background: #f1f3f4;
}

.fr-icon-btn .material-symbols-outlined {
  font-size: 18px;
}

.fr-action-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #1a73e8;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.fr-action-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.fr-options {
  display: flex;
  gap: 12px;
}

.fr-option-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5f6368;
  cursor: pointer;
  user-select: none;
}

.fr-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 24px;
  width: 24px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5f6368;
}

.fr-close-btn:hover {
  background: #f1f3f4;
}

.fr-close-btn .material-symbols-outlined {
  font-size: 16px;
}

/* Highlight colours for find matches */
mark.find-match {
  background: #ffeb3b;
  color: inherit;
  border-radius: 2px;
}

mark.find-match.find-match-active {
  background: #ff9800;
  color: #fff;
}

/* ──────────────────────────────────────────────────────────────
   Word Count dialog
   ────────────────────────────────────────────────────────────── */
.wc-dialog {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wc-dialog[hidden] {
  display: none;
}

.wc-dialog-inner {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
  padding: 24px 28px 20px;
  min-width: 280px;
}

.wc-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 500;
  color: #202124;
}

.wc-stats {
  margin: 0 0 20px;
  padding: 0;
}

.wc-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f3f4;
  font-size: 14px;
  color: #3c4043;
}

.wc-stat-row dt {
  font-weight: 400;
}

.wc-stat-row dd {
  margin: 0;
  font-weight: 500;
  color: #202124;
}

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

.wc-close-btn {
  height: 36px;
  padding: 0 24px;
  border: 0;
  border-radius: 4px;
  background: #1a73e8;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.wc-close-btn:hover {
  background: #1765cc;
}

/* ──────────────────────────────────────────────────────────────
   Page break
   ────────────────────────────────────────────────────────────── */
.page-break {
  width: auto;
  height: 0;
  border: 0;
  border-top: 2px dashed #9aa0a6;
  margin: 18px calc(var(--a4-page-padding-x) * -1);
  position: relative;
  user-select: none;
}

.page-break::after {
  content: 'Page break';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: #f1f3f4;
  font-size: 10px;
  color: #9aa0a6;
  padding: 0 8px;
  pointer-events: none;
}

.auto-page-break {
  width: auto;
  height: var(--a4-page-gap);
  margin: 24px calc(var(--a4-page-padding-x) * -1);
  border-top: 1px solid #d2d7dd;
  position: relative;
  user-select: none;
  pointer-events: none;
}

.auto-page-break::after {
  content: 'A4 page break';
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: #f1f3f4;
  font-size: 10px;
  color: #8d949c;
  padding: 0 8px;
}

@media print {
  .page-break {
    break-after: page;
    border: 0;
    height: 0;
  }

  .auto-page-break {
    break-after: page;
    border: 0;
    height: 0;
    margin: 0;
  }

  .page-break::after {
    display: none;
  }

  .auto-page-break::after {
    display: none;
  }
}


.symbols-dialog[hidden] {
  display: none;
}