@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/Inter-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/fonts/Inter-Italic.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/Inter-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: italic; font-weight: 700; font-display: swap; src: url('/assets/fonts/Inter-BoldItalic.ttf') format('truetype'); }

:root {
  --bg: #0f141c;
  --pill: #1a212d;
  --hover: #262f3d;
  --line: #2a3442;
  --text: #dfe6ee;
  --muted: #7d8b9d;
  --accent: #F5C542;
  --navy: #0A1F44;
  --red: #E4002B;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- toolbar: one dark pill, groups split by hairlines ---------- */
.chrome { position: sticky; top: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: center; gap: 10px; padding: 16px 18px 12px; background: linear-gradient(var(--bg) 70%, rgba(15,20,28,0)); }
.toolbar { display: flex; align-items: stretch; flex-wrap: wrap; height: 44px; background: var(--pill); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.45); overflow: hidden; }
.group { display: flex; align-items: stretch; padding: 0 4px; border-right: 1px solid var(--line); }
.group:first-child { padding-left: 6px; }
.tb, .sw, .pick { display: inline-flex; align-items: center; justify-content: center; margin: 4px 1px; border: 0; background: transparent; color: var(--text); border-radius: 999px; cursor: pointer; transition: background .12s, color .12s; }
.tb { min-width: 34px; height: 34px; padding: 0 9px; font-size: 13px; }
.tb.text { padding: 0 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tb:hover, .pick:hover { background: var(--hover); color: #fff; }
.tb.on { background: rgba(245,197,66,.14); color: var(--accent); }
.tb:focus-visible, .sw:focus-visible, .download:focus-visible, .logout:focus-visible, .pick select:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.glyph { font-size: 15px; line-height: 1; }
.glyph.b { font-weight: 700; }
.glyph.i { font-style: italic; font-family: Georgia, 'Times New Roman', serif; font-size: 17px; }
.glyph.u { text-decoration: underline; text-underline-offset: 2px; }
.sw { width: 30px; height: 34px; padding: 0; }
.sw::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); transition: transform .12s; }
.sw:hover::before { transform: scale(1.12); }
.sw.on::before { box-shadow: 0 0 0 2px var(--pill), 0 0 0 4px var(--accent); }
.pick { position: relative; margin: 4px 1px; padding: 0; }
.pick select { appearance: none; -webkit-appearance: none; height: 34px; padding: 0 26px 0 12px; border: 0; background: transparent; color: var(--text); font: 500 13px/1 'Inter', Arial, sans-serif; cursor: pointer; border-radius: 999px; }
.pick select option { background: var(--pill); color: var(--text); }
.pick::after { content: ''; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.download { border: 0; margin: 0; padding: 0 20px; background: var(--accent); color: #0f1620; font: 700 13px/1 'Inter', Arial, sans-serif; cursor: pointer; transition: background .12s; }
.download:hover { background: #ffdd7a; }
.download[disabled] { opacity: .6; cursor: wait; }
.logout-form { margin: 0; }
.logout { height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--pill); color: var(--muted); font: 500 13px/1 'Inter', Arial, sans-serif; cursor: pointer; transition: color .12s, background .12s; }
.logout:hover { color: #fff; background: var(--hover); }

/* the only message the page shows: overflow / confirmations, under the pill */
.badge { position: absolute; top: 68px; left: 50%; transform: translateX(-50%); max-width: min(92vw, 640px); padding: 8px 14px; border-radius: 999px; background: var(--accent); color: #0f1620; font-size: 12.5px; font-weight: 600; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.badge.err { background: #ff8a80; }

/* ---------- stage / sheet ---------- */
.stage { flex: 1; overflow: auto; padding: 8px 24px 56px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.stage::-webkit-scrollbar { width: 10px; }
.stage::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.holder { position: relative; flex: 0 0 auto; width: 210mm; height: 297mm; }
.sheet { position: absolute; top: 0; left: 0; width: 210mm; height: 297mm; background: #fff; overflow: hidden; transform-origin: top left; box-shadow: 0 26px 70px rgba(0,0,0,.6); }
.sheet .bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; pointer-events: none; }
.guide { position: absolute; left: 10mm; right: 10mm; top: 109mm; height: 145mm; border: 1px dashed rgba(10,31,68,.16); pointer-events: none; }

/* editor box + Quill overrides (quill.core.css is loaded before this file) */
.edit { position: absolute; left: 10mm; right: 10mm; top: 109mm; min-height: 20mm; font-family: 'Inter', Arial, sans-serif; font-size: 10pt; line-height: 1.3; color: #111; }
.edit.ql-container { height: auto; font-family: inherit; font-size: inherit; }
.edit .ql-editor { height: auto; min-height: 20mm; padding: 0; overflow: visible; line-height: inherit; text-align: justify; hyphens: none; caret-color: var(--navy); }
.edit .ql-editor p { margin: 0 0 .85em; }
.edit .ql-editor > :last-child { margin-bottom: 0; }
.edit .ql-editor ol { margin: 0 0 .85em; padding-left: 7mm; }
.edit .ql-editor li { margin: 0; padding-left: 0; }
.edit .ql-editor li > .ql-ui::before { margin-left: -1.5em; margin-right: 0.5em; width: 1em; }
.edit .ql-editor.ql-blank::before { left: 0; right: 0; color: #9aa7b8; font-style: normal; }

/* ---------- login (light, minimal) ---------- */
.login-body { background: #f4f5f7; color: #16202c; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 36px 32px 32px; box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 12px 40px rgba(16,24,40,.08); }
.login h1 { margin: 0 0 26px; font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.login input { display: block; width: 100%; height: 46px; padding: 0 14px; margin-bottom: 12px; background: #fff; color: #16202c; border: 1px solid #dfe3e8; border-radius: 10px; font-family: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.login input::placeholder { color: #98a2b3; }
.login input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(10,31,68,.12); }
.login button { display: block; width: 100%; height: 46px; margin-top: 6px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s; }
.login button:hover { background: #132d5e; }
.login .err { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fff1f2; color: #b4232f; border: 1px solid #fecdd3; font-size: 13px; }

@media (max-width: 900px) {
  .toolbar { height: auto; border-radius: 22px; }
  .download { height: 36px; margin: 4px; border-radius: 999px; }
}
@media (max-width: 640px) {
  .chrome { padding: 8px; flex-wrap: wrap; }
  .stage { padding: 4px 8px 40px; }
  .login { padding: 28px 22px 24px; }
}
