@font-face {
  font-family: Archivo;
  src: url('brand/archivo-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: var(--bg-gray); color: var(--text-primary); font-family: Archivo, system-ui, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, select, input { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
#office { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden; }
#app-chrome { flex: none; background: var(--bg-light); }
.document-header { display: flex; align-items: center; gap: 14px; padding: 14px 24px 10px 20px; }
.app-logo { display: grid; place-items: center; flex: none; width: 42px; height: 46px; border-radius: 10px; }
.app-logo:hover { background: var(--bg-gray); }
.app-logo img { display: block; }
.document-heading { min-width: 0; flex: 1; }
.document-title-row { display: flex; align-items: center; gap: 12px; }
#document-name { width: 265px; max-width: 100%; box-sizing: border-box; padding: 4px 6px; margin-left: -6px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--launch-navy); font-size: 20px; line-height: 1.2; }
#document-name:hover { border-color: var(--border-color); }
#document-name:focus { background: var(--bg-white); }
.app-name { color: var(--text-light); font-size: 11px; white-space: nowrap; }
#document-menu { display: flex; gap: 2px; margin: 2px 0 -2px -8px; }
#document-menu button { padding: 5px 8px; border: 0; border-radius: 5px; background: transparent; font-size: 13px; }
#document-menu button:hover { background: var(--bg-gray); }
#document-menu button[aria-expanded="true"] { background: var(--accent); color: white; }
.header-actions { display: flex; align-items: center; gap: 24px; padding-left: 12px; }
.editing-label { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 12px; }
.editing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.download-button { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 18px; border: 0; border-radius: 22px; background: var(--accent); color: white; font-size: 13px; font-weight: 600; }
.download-button:hover, .download-button[aria-expanded="true"] { background: var(--accent-hover); }
.download-button > :last-child svg { width: 14px; }
.toolbar-shell { padding: 0 16px 12px; }
#formatbar { display: flex; align-items: center; gap: 0; padding: 7px 10px; background: var(--bg-gray); border-radius: 24px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.tool-group { display: flex; align-items: center; gap: 2px; flex: none; padding: 0 7px; height: 28px; border-right: 1px solid var(--border-color); }
.tool-group:first-child { padding-left: 0; }
.tool-group:last-child { border: 0; padding-right: 0; }
#formatbar button, .color-tool { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border: 0; border-radius: 5px; padding: 5px; background: transparent; box-sizing: border-box; }
#formatbar button:hover, .color-tool:hover { background: var(--border-color); }
#formatbar button[aria-pressed="true"], #formatbar button[aria-expanded="true"] { background: var(--accent); color: white; }
svg.ui-icon { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#formatbar select { height: 30px; border: 0; border-radius: 5px; background: transparent; font-size: 12px; cursor: pointer; padding: 0 3px; }
#formatbar select:hover { background: var(--border-color); }
#zoom { width: 67px; }
#paragraph-style { width: 115px; }
#font-family { width: 133px; }
#font-size { width: 36px; height: 25px; box-sizing: border-box; text-align: center; padding: 2px; border: 1px solid var(--border-color); border-radius: 4px; background: var(--bg-light); font-size: 12px; appearance: textfield; }
#font-size::-webkit-inner-spin-button { appearance: none; }
.font-size-group button { width: 23px !important; }
.color-tool { position: relative; cursor: pointer; }
.color-tool input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.color-tool:focus-within { outline: 2px solid var(--accent); }
#editor { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.document-footer { display: flex; align-items: center; gap: 20px; flex: none; height: 28px; padding: 0 22px; background: var(--bg-light); color: var(--text-light); font-size: 11px; }
.footer-brand { margin-left: auto; font-size: 9px; letter-spacing: 1.7px; font-weight: 600; color: var(--accent); }
#menu-popup { position: absolute; z-index: 10; min-width: 250px; padding: 6px; box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 10px; background: white; box-shadow: 0 6px 24px #12213f20, 0 2px 5px #12213f12; overflow-y: auto; }
#menu-popup button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 35px; text-align: left; border: 0; border-radius: 5px; padding: 7px 10px; background: transparent; font-size: 13px; }
#menu-popup button:hover, #menu-popup button:focus-visible { background: var(--accent); color: white; outline: none; }
#menu-popup .menu-shortcut { margin-left: auto; font-size: 11px; opacity: .7; padding-left: 24px; }
#menu-popup hr { height: 0; border: 0; border-top: 1px solid var(--border-color); margin: 5px; }
#notification { position: absolute; z-index: 20; bottom: 44px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 64px); padding: 12px 20px; border-radius: 8px; background: var(--launch-navy); color: white; box-shadow: 0 3px 12px #12213f25; font-size: 13px; }
@media (max-width: 900px) {
  .app-name, .editing-label { display: none; }
  .header-actions { gap: 8px; }
}
@media (max-width: 600px) {
  .document-header { padding: 10px 12px; gap: 8px; }
  .app-logo { width: 30px; }
  .app-logo img { width: 29px; }
  #document-name { width: 100%; font-size: 17px; }
  #document-menu { gap: 0; overflow-x: auto; }
  #document-menu button { padding: 6px; font-size: 12px; }
  .download-button { padding: 0 10px; }
  .download-button > span:not(:first-child) { display: none; }
  .header-actions { padding-left: 0; }
  .toolbar-shell { padding: 0 8px 8px; }
}
#qtcanvas {
  display: block; width: 100%; height: 100%; padding: 0; border: 0;
  outline: none; caret-color: transparent; background: var(--bg-white);
}
#text-input {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px;
  padding: 0; border: 0; opacity: 0; pointer-events: none; resize: none;
}
#loading {
  position: absolute; inset: 0; z-index: 30; display: grid; place-content: center;
  box-sizing: border-box; padding: 24px; text-align: center;
  background: var(--launch-navy); color: var(--bg-white);
}
.brand {
  display: flex; justify-content: center; align-items: center; gap: 12px;
  font-size: 23px; font-weight: 700; letter-spacing: -0.5px;
}
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 10px; background: var(--bg-white);
}
.brand-mark img { display: block; width: 32px; height: 32px; }
#loading h1 { margin: 28px 0 0; font-size: 38px; font-weight: 600; letter-spacing: -1px; }
#status { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: var(--bg-gray); max-width: 32em; }
.loading-indicator {
  width: 160px; height: 3px; margin: 28px auto 0; overflow: hidden;
  background: var(--terminal); border-radius: 3px;
}
.loading-indicator::after {
  content: ''; display: block; height: 100%; width: 50%;
  background: var(--launch-teal); animation: loading 1.6s ease-in-out infinite alternate;
}
@keyframes loading { from { transform: translateX(-50%); } to { transform: translateX(150%); } }
@media (prefers-reduced-motion: reduce) {
  .loading-indicator::after { animation: none; width: 100%; }
}
#loading[data-error] .loading-indicator { display: none; }
[hidden] { display: none !important; }
/* Document loading uses the same web chrome as the editor. */
#open-document-dialog { width: min(460px, calc(100vw - 48px)); padding: 28px; border: 1px solid #d7e2e6; border-radius: 16px; color: #0b1240; background: #f4f8f9; box-shadow: 0 20px 80px #0b124033; }
#open-document-dialog::backdrop { background: #0b124066; }
#open-document-dialog h2 { margin: 0 0 12px; font-size: 22px; }
#open-document-dialog p { line-height: 1.5; font-size: 14px; }
#open-document-dialog label { display: block; margin-top: 18px; font-size: 14px; }
#open-document-dialog label[hidden] { display: none; }
#open-document-dialog input:not([type=checkbox]), #open-document-dialog select { display: block; box-sizing: border-box; width: 100%; margin-top: 8px; padding: 10px; border: 1px solid #b8cbd0; border-radius: 6px; background: white; color: #0b1240; font: inherit; }
#open-document-dialog .discard-warning { padding: 12px; border-radius: 6px; background: #fff3db; line-height: 1.5; }
#open-document-error { color: #9b2828; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.dialog-actions button { padding: 10px 22px; border: 1px solid #b8cbd0; border-radius: 6px; background: white; color: #0b1240; font: inherit; cursor: pointer; }
.dialog-actions #open-document-submit { background: #008080; color: white; border-color: #008080; }
.dialog-actions button:disabled { opacity: .6; cursor: wait; }
