@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700;800&family=Manrope:wght@400;500;600;700;800&family=Noto+Sans+Bengali:wght@400;700&family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;700&family=Open+Sans:wght@400;600;700&family=Lato:wght@400;700&family=Montserrat:wght@400;600;700&family=Nunito:wght@400;600;700&family=Raleway:wght@400;600;700&family=Oswald:wght@400;600;700&family=Poppins:wght@400;500;700&family=Roboto:wght@400;700&family=Source+Sans+3:wght@400;600;700&family=Ubuntu:wght@400;700&family=Noto+Sans:wght@400;700&family=PT+Sans:wght@400;700&family=Cabin:wght@400;700&family=Work+Sans:wght@400;600;700&family=Mulish:wght@400;700&family=Barlow:wght@400;600;700&family=DM+Sans:wght@400;500;700&family=Plus+Jakarta+Sans:wght@400;600;700&family=Outfit:wght@400;600;700&family=Lexend:wght@400;600;700&family=Karla:wght@400;700&family=Rubik:wght@400;700&family=Figtree:wght@400;600;700&family=Sora:wght@400;600;700&family=Quicksand:wght@400;600;700&family=Josefin+Sans:wght@400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;600;700&family=Dosis:wght@400;600;700&family=IBM+Plex+Sans:wght@400;500;700&family=Nunito+Sans:wght@400;600;700&family=Titillium+Web:wght@400;600;700&family=Jost:wght@400;500;700&family=Urbanist:wght@400;600;700&family=Be+Vietnam+Pro:wght@400;600;700&family=Overpass:wght@400;700&family=Red+Hat+Text:wght@400;500;700&family=Albert+Sans:wght@400;600;700&family=Space+Grotesk:wght@400;500;700&family=Instrument+Sans:wght@400;700&family=Bricolage+Grotesque:wght@400;600;700&family=Encode+Sans:wght@400;600;700&family=Heebo:wght@400;700&family=Sarabun:wght@400;700&family=Merriweather:wght@400;700&family=Playfair+Display:wght@400;700&family=Lora:wght@400;700&family=Libre+Baskerville:wght@400;700&family=PT+Serif:wght@400;700&family=Noto+Serif:wght@400;700&family=Crimson+Text:wght@400;600;700&family=EB+Garamond:wght@400;700&family=Cormorant+Garamond:wght@400;600;700&family=Spectral:wght@400;600;700&family=Bitter:wght@400;700&family=Zilla+Slab:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:wght@400;700&family=Cardo:wght@400;700&family=Vollkorn:wght@400;700&family=DM+Serif+Display&family=Source+Code+Pro:wght@400;700&family=JetBrains+Mono:wght@400;700&family=Roboto+Mono:wght@400;700&family=Fira+Code:wght@400;700&family=IBM+Plex+Mono:wght@400;700&family=Space+Mono:wght@400;700&family=Courier+Prime:wght@400;700&family=Inconsolata:wght@400;700&family=Anonymous+Pro:wght@400;700&family=Bebas+Neue&family=Anton&family=Abril+Fatface&family=Righteous&family=Fredoka:wght@400;600;700&family=Pacifico&family=Dancing+Script:wght@400;700&family=Caveat:wght@400;700&family=Kalam:wght@400;700&family=Patrick+Hand&family=Satisfy&family=Courgette&family=Great+Vibes&display=swap');

:root {
    --office-blue: #2c6db6;
    --office-blue-deep: #1f4f8f;
    --office-blue-soft: #d7e8fb;
    --office-silver: #eef2f6;
    --office-silver-line: #b9c7d8;
    --office-text: #1f2933;
    --office-muted: #5a6675;
    --office-page: #ffffff;
    --office-stage: #cfd7df;
    --office-warning: #fff6d8;
    --office-warning-border: #d6b54c;
    --office-error: #fff0f0;
    --office-error-border: #d05d5d;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--office-text);
    background: #dde5ee;
    font-family: "Segoe UI", "Noto Sans Bengali", "Vrinda", Arial, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

.office-ribbon {
    color: var(--office-text);
    background: linear-gradient(#f9fbfe, #dfe8f2);
    border-bottom: 1px solid #9fb4cc;
    box-shadow: 0 2px 9px rgba(24, 54, 84, 0.22);
    position: sticky;
    top: 0;
    z-index: 10;
}

.title-bar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 260px);
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #ffffff;
    background: linear-gradient(#4f93dc, #2e70b8 48%, #225a9b);
}

.app-kicker,
.title-bar h1 {
    margin: 0;
}

.app-kicker {
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
    opacity: 0.86;
}

.title-bar h1 {
    font-size: 20px;
    line-height: 1.2;
    font-weight: 600;
}

.document-title-label {
    font-size: 13px;
    font-weight: 600;
    justify-self: end;
}

.document-title {
    width: 100%;
    min-width: 0;
    border: 1px solid #94b9df;
    border-radius: 4px;
    padding: 8px 10px;
    color: var(--office-text);
    background: #ffffff;
}

.title-bar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.ui-language-switch {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.language-button {
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 999px;
    padding: 6px 12px;
    color: #eef6ff;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    font-weight: 600;
}

.language-button:hover,
.language-button:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.22);
}

.language-button.active {
    color: #103760;
    border-color: rgba(255, 255, 255, 0.74);
    background: #ffffff;
}

.ribbon-tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 6px 10px 0;
    background: linear-gradient(#d9ebfe, #b9d3ef);
}

.ribbon-tab {
    min-width: 74px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    padding: 8px 14px;
    color: #123f6d;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.ribbon-tab:hover {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(107, 139, 178, 0.55);
}

.ribbon-tab.active {
    color: #0f2f52;
    background: linear-gradient(#ffffff, #edf3fa);
    border-color: #93abc7;
}

.ribbon-panel {
    display: none;
    align-items: stretch;
    gap: 12px;
    min-height: 88px;
    padding: 10px 12px 12px;
    overflow-x: auto;
    background: linear-gradient(#ffffff, var(--office-silver));
}

.ribbon-panel.active {
    display: flex;
}

.ribbon-group {
    display: flex;
    align-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: max-content;
    padding: 8px 12px 22px;
    border-right: 1px solid var(--office-silver-line);
    position: relative;
}

.ribbon-group:last-child {
    border-right: 0;
}

.group-title {
    position: absolute;
    right: 12px;
    bottom: 2px;
    left: 12px;
    color: var(--office-muted);
    font-size: 11px;
    text-align: center;
}

.ribbon-button,
.ribbon-select,
.ribbon-color,
.ribbon-input,
.ribbon-textarea {
    border: 1px solid #aebdcb;
    border-radius: 4px;
    background: linear-gradient(#ffffff, #e9eef4);
    color: var(--office-text);
    min-height: 32px;
}

.ribbon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 42px;
    padding: 6px 10px;
    cursor: pointer;
    white-space: nowrap;
}

.ribbon-button:hover,
.ribbon-button:focus-visible {
    border-color: #5a98d5;
    background: linear-gradient(#f8fdff, #cfe6ff);
    outline: none;
}

.ribbon-button:active {
    background: linear-gradient(#bdd9f7, #eaf5ff);
}

.ribbon-button.primary {
    color: #ffffff;
    border-color: #1f5c9e;
    background: linear-gradient(#4a94de, #2b68ab);
}

.ribbon-button.primary:hover,
.ribbon-button.primary:focus-visible {
    background: linear-gradient(#62a7e8, #3979bf);
}

.ribbon-button.is-active {
    color: #ffffff;
    border-color: #1f5c9e;
    background: linear-gradient(#4a94de, #2b68ab);
}

.icon-button {
    width: 34px;
    padding-inline: 0;
}

.control-label {
    color: var(--office-muted);
    font-size: 12px;
}

.ribbon-select {
    width: 68px;
    padding: 4px 6px;
}

.ribbon-select-wide {
    width: 136px;
}

.ribbon-select-family {
    width: 170px;
}

.ribbon-color {
    width: 34px;
    padding: 2px;
    cursor: pointer;
}

.ribbon-input {
    padding: 4px 8px;
}

.ribbon-textarea {
    width: 100%;
    min-height: 84px;
    padding: 7px 9px;
    resize: vertical;
    line-height: 1.4;
}

.ribbon-textarea-wide {
    width: 280px;
}

.ribbon-input-wide {
    width: 180px;
}

.ribbon-number {
    width: 68px;
}

.ribbon-group-form {
    gap: 8px;
}

.ribbon-group-wide {
    max-width: 440px;
}

.ribbon-search-group {
    max-width: 820px;
}

.ribbon-table-group {
    max-width: 1040px;
}

.ribbon-auto-typer-group select,
.ribbon-auto-typer-group input[type="number"],
.ribbon-auto-typer-group button {
    margin-bottom: 2px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 0 4px;
    margin-top: 2px;
}

.tmpl-btn {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.tmpl-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tmpl-1 { background-color: #2c6db6; }
.tmpl-2 { background-color: #16a34a; }
.tmpl-3 { background-color: #facc15; }
.tmpl-4 { background-color: #dc2626; }
.tmpl-5 { background-color: #9333ea; }
.tmpl-6 { background-color: #ea580c; }
.tmpl-7 { background-color: #06b6d4; }
.tmpl-8 { background-color: #475569; }
.tmpl-9 { background-color: #e11d48; }
.tmpl-10 { background-color: #f8fafc; }

.ribbon-auto-typer-group {
    max-width: 520px;
    align-items: flex-start;
}

.ribbon-note {
    width: 150px;
    margin: 0;
    color: var(--office-muted);
    font-size: 12px;
    line-height: 1.3;
}

.ribbon-search-status {
    width: 100%;
    margin: 2px 0 0;
    color: var(--office-muted);
    font-size: 12px;
    line-height: 1.35;
}

.notice {
    padding: 10px 14px;
    border-bottom: 1px solid var(--office-warning-border);
    color: #5d4b09;
    background: var(--office-warning);
    font-size: 14px;
}

.notice.error {
    color: #7d1f1f;
    background: var(--office-error);
    border-bottom-color: var(--office-error-border);
}

.notice code {
    font-family: Consolas, "Courier New", monospace;
    font-weight: 600;
}

.workspace {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--office-stage);
}

.workspace-body {
    flex: 1;
    min-height: 0;
    display: flex;
}

.editor-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    color: #334153;
    background: #f7f9fc;
    border-bottom: 1px solid #c2ccd8;
    font-size: 13px;
}

.meta-keyboard-button {
    margin-left: auto;
    min-height: 30px;
    border: 1px solid #8aa9ca;
    border-radius: 4px;
    padding: 5px 12px;
    color: #ffffff;
    background: linear-gradient(#4a94de, #2b68ab);
    cursor: pointer;
    font-weight: 600;
}

.meta-keyboard-button:hover,
.meta-keyboard-button:focus-visible {
    border-color: #1f5c9e;
    background: linear-gradient(#62a7e8, #3979bf);
    outline: none;
}

.meta-keyboard-button.active {
    color: #123f6d;
    background: linear-gradient(#ffffff, #d7e8fb);
}

.page-stage {
    flex: 1;
    min-width: 0;
    overflow: auto;
    padding: 24px;
}

.page-zoom-frame {
    --zoom-scale: 1;
    position: relative;
    width: 210mm;
    height: auto;
    margin: 0 auto;
}

.page-canvas {
    width: var(--page-width);
    transform: scale(var(--zoom-scale));
    transform-origin: top center;
}

.document-ruler {
    margin: 0 0 12px;
    padding: 8px 10px 10px;
    border: 1px solid #b7c5d5;
    border-radius: 9px;
    background: linear-gradient(#f8fbff, #e2ebf4);
    box-shadow: 0 2px 10px rgba(29, 53, 77, 0.12);
}

.document-ruler-track {
    position: relative;
    height: 42px;
    border: 1px solid #cad5e2;
    border-radius: 7px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
        linear-gradient(90deg, rgba(140, 159, 180, 0.14) 0, rgba(140, 159, 180, 0.14) 1px, transparent 1px, transparent 10px);
    overflow: hidden;
}

.document-ruler-marks {
    position: absolute;
    inset: 0;
}

.document-ruler-mark,
.document-ruler-label {
    position: absolute;
    left: 0;
    transform: translateX(-50%);
}

.document-ruler-mark {
    bottom: 5px;
    width: 1px;
    height: 10px;
    background: rgba(44, 87, 132, 0.42);
}

.document-ruler-mark.is-major {
    height: 16px;
    background: rgba(31, 79, 143, 0.62);
}

.document-ruler-label {
    top: 4px;
    color: #45617d;
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
}

.document-ruler-margin {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(122, 150, 182, 0.18);
    pointer-events: none;
}

.document-ruler-margin-left {
    left: 0;
}

.document-ruler-margin-right {
    right: 0;
}

.document-ruler-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 28px;
    border: 1px solid #1f5c9e;
    border-radius: 999px;
    background: linear-gradient(#4a94de, #2b68ab);
    box-shadow: 0 2px 8px rgba(20, 48, 78, 0.18);
    cursor: ew-resize;
    transform: translate(-50%, -50%);
}

.document-ruler-handle::before {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    bottom: 5px;
    left: 5px;
    border-left: 2px solid rgba(255, 255, 255, 0.95);
    border-right: 2px solid rgba(255, 255, 255, 0.95);
}

.document-ruler-handle-right {
    transform: translate(50%, -50%);
}

.document-ruler-handle:hover,
.document-ruler-handle:focus-visible {
    outline: none;
    background: linear-gradient(#62a7e8, #3979bf);
}

.document-sheet {
    --page-width: 210mm;
    --page-height: 297mm;
    --margin-top: 18mm;
    --margin-right: 18mm;
    --margin-bottom: 18mm;
    --margin-left: 18mm;
    --header-offset: 8mm;
    --footer-offset: 8mm;
    position: relative;
    width: var(--page-width);
    min-height: var(--page-height);
    margin: 0 auto;
    background: var(--office-page);
    border: 1px solid #b7c0ca;
    box-shadow: 0 3px 14px rgba(42, 58, 76, 0.22);
}

.document-running {
    position: absolute;
    z-index: 2;
    left: var(--margin-left);
    right: var(--margin-right);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    color: #6c7684;
    font-size: 11px;
    line-height: 1.2;
    pointer-events: none;
}

.document-running.is-empty {
    display: none;
}

.document-running-header {
    top: var(--header-offset);
}

.document-running-footer {
    bottom: var(--footer-offset);
}

.document-running-slot {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-running-slot.slot-start {
    text-align: left;
}

.document-running-slot.slot-center {
    text-align: center;
}

.document-running-slot.slot-end {
    text-align: right;
}

.editor-page {
    min-height: var(--page-height);
    padding: var(--margin-top) var(--margin-right) var(--margin-bottom) var(--margin-left);
    color: #202124;
    background: transparent;
    border: 0;
    box-shadow: none;
    outline: none;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.editor-page .search-match {
    border-radius: 3px;
    background: #fff2a8;
    box-shadow: inset 0 -0.2em 0 rgba(227, 182, 54, 0.35);
}

.editor-page .search-match-current {
    background: #ffc967;
    box-shadow: inset 0 -0.2em 0 rgba(188, 109, 17, 0.42);
    outline: 1px solid rgba(160, 87, 10, 0.35);
}

::highlight(office-search-match) {
    background: #fff2a8;
    color: inherit;
}

::highlight(office-search-current) {
    background: #ffc967;
    color: inherit;
}

.editor-page:empty::before {
    content: attr(data-placeholder);
    color: #7b8794;
}

.editor-page h1,
.editor-page h2,
.editor-page h3 {
    color: #1f4f8f;
    line-height: 1.25;
}

.editor-page h1 {
    font-size: 2em;
}

.editor-page h2 {
    font-size: 1.5em;
}

.editor-page blockquote {
    margin: 14px 0;
    padding: 10px 14px;
    border-left: 4px solid #7aa3d1;
    border-radius: 0 10px 10px 0;
    background: #edf4fb;
    color: #334153;
}

.editor-page pre {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid #d4dee9;
    border-radius: 10px;
    background: #edf3f9;
    color: #203446;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.editor-page .office-page-break {
    position: relative;
    display: block;
    height: 0;
    margin: 28px 0 24px;
    border-top: 2px dashed #90b1d3;
    user-select: none;
}

.editor-page .office-page-break::before {
    content: "Page Break";
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2px 11px;
    border: 1px solid #b2c6db;
    border-radius: 999px;
    color: #2f6ba9;
    background: #f7fbff;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.editor-page img {
    max-width: 100%;
    height: auto;
}

#officeImageResizer {
    position: absolute;
    border: 2px dashed #2c6db6;
    z-index: 10000;
    pointer-events: none;
    box-sizing: border-box;
}

#officeImageResizer .resizer-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #2c6db6;
    border-radius: 50%;
    pointer-events: auto;
}

#officeImageResizer .nw { top: -6px; left: -6px; cursor: nwse-resize; }
#officeImageResizer .ne { top: -6px; right: -6px; cursor: nesw-resize; }
#officeImageResizer .sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
#officeImageResizer .se { bottom: -6px; right: -6px; cursor: nwse-resize; }
#officeImageResizer .move-handle { 
    top: -10px; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 20px; 
    height: 20px; 
    background: #2c6db6 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="white" viewBox="0 0 16 16"><path d="M8 0a.5.5 0 0 1 .5.5v3h-1V1.207l-1.146 1.147-.708-.708L8 0zm0 16a.5.5 0 0 1-.5-.5v-3h1v2.293l1.146-1.147.708.708L8 16zM0 8a.5.5 0 0 1 .5-.5h3v1H1.207l1.147 1.146-.708.708L0 8zm16 0a.5.5 0 0 1-.5.5h-3v-1h2.293l-1.147-1.146.708-.708L16 8z"/></svg>') center no-repeat;
    cursor: move;
    border: 2px solid white;
}

.editor-page table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    max-width: 100%;
}

.editor-page td,
.editor-page th {
    min-width: 70px;
    border: 1px solid #657487;
    padding: 8px;
    vertical-align: top;
}

.table-editor-overlay {
    position: absolute;
    z-index: 5;
    border: 2px solid rgba(74, 148, 222, 0.95);
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(18, 63, 109, 0.16);
    pointer-events: none;
}

.table-editor-overlay.is-hidden {
    display: none;
}

.table-editor-overlay.is-dragging {
    border-style: dashed;
}

.table-editor-handle {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #1f5c9e;
    color: #ffffff;
    background: linear-gradient(#4a94de, #2b68ab);
    box-shadow: 0 2px 5px rgba(24, 54, 84, 0.16);
    pointer-events: auto;
    user-select: none;
}

.table-move-handle {
    top: -16px;
    left: 10px;
    min-height: 24px;
    border-radius: 999px;
    padding: 4px 10px;
    cursor: grab;
    font-size: 11px;
    font-weight: 700;
}

.table-resize-handle {
    right: -10px;
    bottom: -10px;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    cursor: nwse-resize;
}

.table-resize-handle-left {
    right: auto;
    left: -10px;
    cursor: nesw-resize;
}

.table-column-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.table-row-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.table-column-handle {
    position: absolute;
    top: 8px;
    bottom: 8px;
    width: 14px;
    margin-left: -7px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: col-resize;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.table-column-handle.is-hovered {
    opacity: 1;
    pointer-events: auto;
}

.table-column-handle::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(31, 92, 158, 0.85);
}

.table-row-handle {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 14px;
    margin-top: -7px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: row-resize;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.table-row-handle.is-hovered {
    opacity: 1;
    pointer-events: auto;
}

.table-row-handle::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    background: rgba(31, 92, 158, 0.85);
}

.office-shell.table-moving,
.office-shell.table-resizing {
    user-select: none;
}

.office-shell.table-moving .table-move-handle {
    cursor: grabbing;
}

.word-count-panel {
    width: 300px;
    flex: 0 0 300px;
    overflow: auto;
    border-left: 1px solid #c2ccd8;
    background: linear-gradient(#f8fbff, #e3ebf4);
    padding: 16px 14px 18px;
}

.word-count-panel.is-hidden {
    display: none;
}

.word-count-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.word-count-kicker,
.word-count-header h2 {
    margin: 0;
}

.word-count-kicker {
    color: #5f6d7d;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.word-count-header h2 {
    color: #123f6d;
    font-size: 20px;
    line-height: 1.15;
}

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

.word-count-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 100px;
    border: 1px solid #c8d4e0;
    border-radius: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(28, 55, 84, 0.08);
}

.word-count-card-wide {
    grid-column: 1 / -1;
    min-height: 118px;
}

.word-count-label {
    color: #5f6d7d;
    font-size: 12px;
    font-weight: 600;
}

.word-count-value {
    color: #123f6d;
    font-size: 28px;
    line-height: 1;
    font-weight: 700;
}

.word-count-meta {
    color: #5f6d7d;
    font-size: 12px;
    line-height: 1.4;
}

.office-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    color: #eff6ff;
    background: linear-gradient(#2e70b8, #225a9b);
    font-size: 13px;
}

.virtual-keyboard {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    width: min(720px, calc(100vw - 24px));
    max-height: 54vh;
    overflow: auto;
    border: 1px solid #9fb4cc;
    border-radius: 8px;
    background: linear-gradient(#f8fbff, #dfe8f2);
    box-shadow: 0 8px 26px rgba(24, 54, 84, 0.28);
    padding: 8px 10px 10px;
    user-select: none;
}

.virtual-keyboard.is-hidden {
    display: none;
}

.keyboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -8px -10px 8px;
    padding: 7px 9px;
    color: #ffffff;
    background: linear-gradient(#4a94de, #2b68ab);
    border-radius: 7px 7px 0 0;
    cursor: move;
    touch-action: none;
}

.keyboard-drag-hint {
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
}

.phonetic-preview {
    display: inline-block;
    min-width: 90px;
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
}

.keyboard-actions,
.keyboard-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.keyboard-actions {
    justify-content: flex-end;
}

.keyboard-keys {
    display: grid;
    gap: 4px;
}

.keyboard-row {
    justify-content: center;
    gap: 4px;
}

.keyboard-key,
.keyboard-mode,
.keyboard-close {
    min-height: 28px;
    border: 1px solid #aebdcb;
    border-radius: 4px;
    color: var(--office-text);
    background: linear-gradient(#ffffff, #e9eef4);
    cursor: pointer;
}

.keyboard-key {
    min-width: 32px;
    padding: 4px 7px;
    font-size: 13px;
}

.keyboard-key.wide {
    min-width: 58px;
}

.keyboard-key.extra-wide {
    min-width: 150px;
}

.keyboard-mode,
.keyboard-close {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
}

.keyboard-key.active,
.keyboard-mode.active,
.keyboard-mode[aria-pressed="true"] {
    color: #ffffff;
    border-color: #1f5c9e;
    background: linear-gradient(#4a94de, #2b68ab);
}

.keyboard-key:hover,
.keyboard-key:focus-visible,
.keyboard-mode:hover,
.keyboard-mode:focus-visible,
.keyboard-close:hover,
.keyboard-close:focus-visible {
    border-color: #5a98d5;
    background: linear-gradient(#f8fdff, #cfe6ff);
    outline: none;
}

.keyboard-help {
    margin: 6px 0 0;
    color: var(--office-muted);
    font-size: 11px;
    line-height: 1.4;
}

.office-shell.keyboard-open {
    padding-bottom: 0;
}

.office-shell.fullscreen .office-ribbon,
.office-shell.fullscreen .notice,
.office-shell.fullscreen .virtual-keyboard,
.office-shell.fullscreen .office-footer {
    display: none;
}

.office-shell.fullscreen .page-stage {
    padding: 10px;
}

@media print {
    body {
        background: #ffffff;
    }

    .office-ribbon,
    .notice,
    .editor-meta,
    .word-count-panel,
    .virtual-keyboard,
    .office-footer,
    .document-ruler {
        display: none;
    }

    .workspace,
    .page-stage {
        display: block;
        padding: 0;
        overflow: visible;
        background: #ffffff;
    }

    .page-zoom-frame {
        width: 100% !important;
        height: auto !important;
    }

    .page-canvas {
        width: 100% !important;
        transform: none !important;
    }

    .document-sheet {
        width: 100%;
        min-height: 0;
        margin: 0;
        border: 0;
        box-shadow: none;
    }

    .document-running {
        color: #4c5561;
    }

    .editor-page {
        min-height: 0;
    }

    .editor-page .office-page-break {
        height: 0;
        margin: 0;
        border: 0;
        break-after: page;
        page-break-after: always;
    }

    .editor-page .office-page-break::before {
        display: none;
    }
}

@media (max-width: 760px) {
    .title-bar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .document-title-label {
        justify-self: start;
    }

    .title-bar-controls {
        grid-template-columns: 1fr;
    }

    .ui-language-switch {
        justify-content: flex-start;
    }

    .ribbon-panel {
        min-height: auto;
    }

    .ribbon-group {
        min-width: 220px;
        border-right: 0;
        border-bottom: 1px solid var(--office-silver-line);
    }

    .ribbon-button {
        flex: 1 1 auto;
    }

    .page-stage {
        padding: 12px;
    }

    .page-zoom-frame {
        width: 100%;
    }

    .document-sheet {
        width: 100%;
        min-height: 74vh;
    }

    .document-ruler {
        padding-inline: 6px;
    }

    .document-ruler-track {
        height: 38px;
    }

    .workspace-body {
        flex-direction: column;
    }

    .word-count-panel {
        width: auto;
        flex-basis: auto;
        border-top: 1px solid #c2ccd8;
        border-left: 0;
    }

    .editor-page {
        padding: calc(var(--margin-top) * 0.75) calc(var(--margin-right) * 0.7) calc(var(--margin-bottom) * 0.75) calc(var(--margin-left) * 0.7);
        font-size: 15px;
    }

    .document-running {
        left: calc(var(--margin-left) * 0.7);
        right: calc(var(--margin-right) * 0.7);
        font-size: 10px;
    }

    .office-footer {
        flex-direction: column;
    }

    .keyboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .keyboard-actions {
        justify-content: flex-start;
    }

    .keyboard-key {
        flex: 1 1 30px;
        min-width: 30px;
    }

    .keyboard-key.extra-wide {
        min-width: 110px;
    }

    .meta-keyboard-button {
        width: 100%;
        margin-left: 0;
    }

    .word-count-grid {
        grid-template-columns: 1fr;
    }

    .word-count-card-wide {
        grid-column: auto;
    }

    .office-shell.keyboard-open {
        padding-bottom: 0;
    }

    .virtual-keyboard {
        right: 8px;
        bottom: 8px;
        width: calc(100vw - 16px);
        max-height: 58vh;
    }
}

/* --- Instruction Modal Styles --- */
.instruction-modal {
    display: none; 
    position: fixed; 
    z-index: 100000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    align-items: center;
    justify-content: center;
}

.instruction-modal-content {
    background-color: #fefefe;
    padding: 24px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
    font-family: 'Segoe UI', 'Noto Sans Bengali', sans-serif;
}

.close-instruction-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-instruction-modal:hover,
.close-instruction-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-title {
    color: #2c6db6;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    border-bottom: 2px solid #e1e9f2;
    padding-bottom: 10px;
}

.modal-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-card {
    background: #f7fbff;
    border: 1px solid #b2c6db;
    padding: 15px;
    border-radius: 6px;
}

.modal-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #1f4f8f;
}

.modal-card ol {
    margin: 0;
    padding-left: 20px;
    line-height: 1.6;
}

.modal-card p {
    margin: 5px 0;
    line-height: 1.6;
}

.close-instruction-btn {
    margin-top: 20px;
    display: block;
    width: 100%;
    padding: 10px;
    background: #2c6db6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
}

.close-instruction-btn:hover {
    background: #1f4f8f;
}
