/* Kraftoz Shabd: the document area (style.css is the Kraftoz look shared with Ganit). */
#app.shabd { grid-template-rows: 32px 28px auto auto minmax(0, 1fr) 24px; }
#app.shabd #msgbar { grid-row: 4; }
#app.shabd #canvas { grid-row: 5; }
#app.shabd #statusbar { grid-row: 6; }
#msgbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: #fff7ed; border-bottom: 1px solid #fed7aa; font-size: 12.5px; }
#msgbar.off { display: none; }
#msgbar .mb-i { color: #c2410c; font-weight: 700; }
#msgbar .mb-t { flex: 1; }
#msgbar button { border: 1px solid #fdba74; background: #fff; border-radius: 4px; padding: 3px 10px; cursor: default; }
#msgbar button:hover { background: #ffedd5; }
#msgbar .mb-x { border: 0; background: none; font-size: 16px; padding: 0 4px; }

/* Print Layout: the pages on grey, the text flowing over them. */
#canvas { position: relative; overflow: auto; background: #e3e5e9; }
#sizer { position: relative; margin: 20px auto 28px; }
#zoomer { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#pages { position: absolute; inset: 0; }
.page { position: absolute; left: 0; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .22), 0 0 0 1px rgba(15, 23, 42, .06); }
.hslot, .fslot { position: absolute; min-height: 2px; }
.hslot.hf-on, .fslot.hf-on { outline: 1px dashed #94a3b8; outline-offset: 2px; }
.hslot.editing::after, .fslot.editing::after { content: attr(data-label); }
.hslot:not(.editing):not(:empty), .fslot:not(.editing):not(:empty) { cursor: default; }
#doc.dim, .hslot:not(.editing), .fslot:not(.editing) { opacity: 1; }
#doc.dim { opacity: .5; }
.hslot:not(.editing) .doc, .hslot:not(.editing) p, .fslot:not(.editing) p { color: inherit; }
#pages .hslot:not(.editing), #pages .fslot:not(.editing) { opacity: .62; }
#hfedit { outline: none; min-height: 18px; }
#doc { position: absolute; outline: none; display: flex; flex-direction: column; caret-color: #000; user-select: text; -webkit-user-select: text; }
.doc { font-family: Calibri, Carlito, "Nirmala UI", "Noto Sans Devanagari", sans-serif; font-size: 11pt; color: #000; cursor: text; }
.doc p { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; tab-size: 48px; -moz-tab-size: 48px; min-height: 1em; }
.doc p[data-marker]::before { content: attr(data-marker); display: inline-block; min-width: var(--hang, 24px); text-indent: 0; font-style: normal; font-weight: 400; text-decoration: none; }
.doc span.pb { display: block; height: 0; margin: 4px 0; }
.doc.marks span.pb, #doc.marks span.pb { height: auto; border-top: 1px dotted #6b7280; color: #6b7280; font-size: 8pt; text-align: center; }
.doc.marks span.pb::after { content: "Page Break"; position: relative; top: -7px; background: #fff; padding: 0 6px; }
#doc.marks p::after { content: "¶"; color: #3b82f6; font-family: system-ui, sans-serif; font-weight: 400; font-style: normal; }
.doc span.fld { background: rgba(148, 163, 184, .18); border-radius: 2px; }
#print-area .doc span.fld, .pv-paper .doc span.fld, #pages .hslot:not(.editing) span.fld { background: none; }
.doc span.pgap { display: inline-block; width: 0; vertical-align: baseline; user-select: none; }
.doc img.pic { vertical-align: baseline; cursor: default; }
.doc span.run[title] { cursor: text; }
#doc.painting { cursor: copy; }
.doc table.tbl { border-collapse: collapse; table-layout: fixed; margin: 0; flex: none; }
.doc table.tbl td { padding: 0 7.2px; vertical-align: top; border: 1px dotted #c7d2fe; }
.doc table.tbl.grid td { border: 0.67px solid #000; }
#print-area .doc table.tbl:not(.grid) td, .pv-paper .doc table.tbl:not(.grid) td { border-color: transparent; }
#picbox { position: absolute; border: 1px solid #b42346; pointer-events: none; z-index: 5; }
#picbox .ph { position: absolute; right: -5px; bottom: -5px; width: 9px; height: 9px; background: #fff; border: 1px solid #b42346; pointer-events: auto; cursor: nwse-resize; }

/* Styles gallery */
#style-gallery { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, 33px); gap: 2px; max-width: 560px; overflow: hidden; }
.sg { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; width: 86px; height: 33px; padding: 1px 6px; border: 1px solid transparent; background: #fff; border-radius: 3px; overflow: hidden; cursor: default; }
.sg:hover { border-color: #d6dbe3; background: var(--hover); }
.sg.on { border-color: #fda4af; background: var(--accent-soft); }
.sg-a { white-space: nowrap; line-height: 1.1; }
.sg-n { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* Menus: the table grid, symbols, bullets */
.tgrid { display: grid; grid-template-columns: repeat(10, 16px); gap: 2px; padding: 6px 12px 2px; }
.tgrid i { width: 16px; height: 16px; border: 1px solid #c3c8d0; background: #fff; display: block; }
.tgrid i.on { border-color: #b42346; background: #ffe4e6; }
.tgrid-l { padding: 2px 12px 6px; color: var(--muted); font-size: 11.5px; }
.symgrid { display: grid; grid-template-columns: repeat(9, 30px); gap: 2px; padding: 6px 10px; }
.symgrid i, .libgrid i { font-style: normal; display: flex; align-items: center; justify-content: center; height: 30px; border: 1px solid #e5e7eb; background: #fff; font-size: 16px; cursor: default; }
.symgrid i:hover, .libgrid i:hover { border-color: #b42346; background: #fff1f2; }
.libgrid { display: grid; grid-template-columns: repeat(4, 44px); gap: 4px; padding: 6px 10px; }
.libgrid.wide { grid-template-columns: repeat(4, 72px); }
.libgrid.wide i { font-size: 12px; }
.swatches.hl { grid-template-columns: repeat(5, 22px); }
.swatches.hl i { width: 22px; height: 22px; }

/* Dialogs */
.dialog h4 { margin: 12px 0 2px; font-size: 12px; color: #374151; border-bottom: 1px solid #e5e7eb; padding-bottom: 2px; }
.dialog .opts2 { display: grid; grid-template-columns: 1fr 1fr; }
.dialog .hint { color: var(--muted); margin: 4px 0; }
.dialog table.wc { border-collapse: collapse; min-width: 280px; }
.dialog table.wc td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }
.dialog table.wc td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.dialog .keys { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; max-height: 60vh; overflow: auto; }
.dialog .keys .kk { font-family: ui-monospace, Menlo, Consolas, monospace; color: #374151; white-space: nowrap; }
.backdrop.modeless { background: transparent; pointer-events: none; align-items: flex-start; justify-content: flex-end; padding: 150px 40px 0 0; }
.backdrop.modeless .dialog { pointer-events: auto; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); }
.view-btn { border: 0; background: none; color: inherit; padding: 0 4px; }
.view-btn.on { background: rgba(255,255,255,.18); border-radius: 3px; }
#st-page, #st-words, #st-lang { white-space: nowrap; }

/* Print: each page as on screen */
#printview .pv-scroll { display: block; overflow: auto; padding: 16px 24px; align-items: initial; justify-content: initial; }
#printview .pv-scroll .ppage { margin: 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.ppage { position: relative; background: #fff; overflow: hidden; transform-origin: 0 0; }
.ppage .hslot, .ppage .fslot { opacity: 1 !important; outline: none !important; }
.ppage .pwin { position: absolute; overflow: hidden; }
.ppage .doc { display: flex; flex-direction: column; }
@media print {
  #print-area .ppage { break-after: page; page-break-after: always; box-shadow: none; }
  #print-area .ppage:last-child { break-after: auto; page-break-after: auto; }
}
