:root {
    --titlebar-height: 50px;
    --ribbon-height: 106px;
    --nav-height: calc(var(--titlebar-height) + var(--ribbon-height));
    --office-status-height: 30px;
    --office-blue: #1f23ab;
    --office-blue-soft: #eef0ff;
    --office-border: #e2e5ec;
    --office-panel: #f7f8fa;
}

html {
    scroll-padding-top: calc(var(--nav-height) + 10px);
}

.app {
    padding-top: var(--nav-height);
}

.topbar {
    min-height: var(--titlebar-height);
    height: var(--titlebar-height);
    grid-template-columns: minmax(250px, 1fr) auto minmax(150px, 1fr);
    padding: 5px 18px;
    gap: 12px;
    background: #fff;
    backdrop-filter: none;
}

.brand {
    gap: 14px;
}

.brand a {
    flex: none;
}

.document-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-left: 14px;
    border-left: 1px solid var(--office-border);
    line-height: 1.2;
}

.document-meta strong {
    max-width: 260px;
    overflow: hidden;
    color: #20232d;
    font-size: 13px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-meta span {
    color: #8a919f;
    font-size: 10px;
}

.action-center {
    gap: 2px;
}

.topbar .tool-btn {
    min-width: 42px;
    padding: 6px 8px;
    font-size: 13px;
}

.topbar .tool-btn i {
    font-size: 13px;
}

.topbar .nav-link {
    min-height: 30px;
    font-size: 13px;
}

.office-ribbon {
    position: fixed;
    top: var(--titlebar-height);
    left: 0;
    right: 0;
    z-index: 48;
    height: var(--ribbon-height);
    border-bottom: 1px solid var(--office-border);
    background: #fff;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.05);
}

.ribbon-tabs {
    height: 30px;
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 0 18px;
    border-top: 1px solid #f0f1f5;
    border-bottom: 1px solid var(--office-border);
}

.ribbon-tab {
    min-width: 58px;
    padding: 0 13px;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #525866;
    background: transparent;
    font-size: 12px;
}

.ribbon-tab:hover {
    color: var(--office-blue);
    background: #f7f7fb;
}

.ribbon-tab.active {
    color: var(--office-blue);
    border-bottom-color: var(--office-blue);
    font-weight: 700;
}

.ribbon-panels {
    height: 76px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.ribbon-panel {
    display: none;
    align-items: stretch;
    min-width: max-content;
    height: 100%;
    padding: 5px 12px 4px;
}

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

.ribbon-group {
    position: relative;
    min-width: 86px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    padding: 2px 10px 16px;
    border-right: 1px solid var(--office-border);
}

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

.ribbon-group-label {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 0;
    color: #9298a5;
    text-align: center;
    font-size: 9px;
    line-height: 13px;
}

.ribbon-command {
    min-width: 46px;
    height: 48px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 7px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #434957;
    background: transparent;
    font-size: 10px;
    line-height: 1;
}

.ribbon-command i {
    color: #4c5466;
    font-size: 17px;
}

.ribbon-command.compact {
    min-width: 54px;
}

.ribbon-command:hover,
.ribbon-command.active,
.ribbon-icon-btn:hover {
    color: var(--office-blue);
    border-color: #d7daf9;
    background: var(--office-blue-soft);
}

.ribbon-command:hover i,
.ribbon-command.active i {
    color: var(--office-blue);
}

.ribbon-command:disabled,
.ribbon-icon-btn:disabled,
.ribbon-select:disabled,
.ribbon-color-btn:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.34;
}

.ribbon-font-group {
    min-width: 230px;
    display: grid;
    grid-template-columns: 132px 52px;
    grid-template-rows: 25px 25px;
    align-content: start;
}

.ribbon-select {
    min-width: 0;
    height: 24px;
    padding: 0 6px;
    border: 1px solid #d9dce5;
    border-radius: 4px;
    color: #343946;
    background: #fff;
    font-size: 11px;
}

.ribbon-select.narrow {
    width: 52px;
}

.ribbon-inline-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    grid-column: 1 / -1;
}

.ribbon-icon-btn,
.ribbon-color-btn {
    width: 27px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #434957;
    background: transparent;
    font-size: 12px;
}

.ribbon-color-btn {
    position: relative;
    cursor: pointer;
}

.ribbon-color-btn input {
    position: absolute;
    inset: auto 3px 2px;
    width: 21px;
    height: 3px;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.ribbon-insert-group {
    min-width: 270px;
}

.ribbon-zoom-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #555c6b;
    font-size: 11px;
}

.ribbon-range {
    width: 130px;
    accent-color: var(--office-blue);
}

.restore-draft-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 14px;
    border: 1px solid #d9dcfa;
    border-radius: 10px;
    color: #353b78;
    background: #f5f6ff;
    text-align: left;
}

.restore-draft-card[hidden] {
    display: none;
}

.restore-draft-card i {
    font-size: 22px;
}

.restore-draft-card span {
    display: grid;
    gap: 3px;
}

.restore-draft-card small {
    color: #747b91;
}

.home-view {
    min-height: max(520px, calc(100vh - var(--nav-height) - var(--site-footer-height)));
    align-items: flex-start;
    justify-content: center;
    padding: 26px 24px 34px;
    overflow: auto;
    background:
        radial-gradient(circle at 14% 0%, rgba(99, 102, 241, 0.09), transparent 28%),
        linear-gradient(180deg, #f7f8fc 0%, #f2f3f7 100%);
}

.start-center {
    width: min(1180px, 100%);
    display: grid;
    gap: 20px;
}

.start-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 0 2px;
}

.start-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    color: var(--office-blue);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.04em;
}

.start-heading h1 {
    margin: 0;
    color: #171923;
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.start-heading p {
    margin: 8px 0 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.65;
}

.start-primary {
    min-height: 42px;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border: 1px solid #1f23ab;
    border-radius: 8px;
    color: #fff;
    background: #1f23ab;
    box-shadow: 0 8px 22px rgba(31, 35, 171, 0.2);
    font-size: 13px;
    font-weight: 700;
    scroll-margin-top: calc(var(--nav-height) + 10px);
}

.start-primary:hover {
    background: #181b91;
    transform: translateY(-1px);
}

.local-open-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border: 1px solid #daddfa;
    border-radius: 8px;
    color: #4c5270;
    background: #f5f6ff;
    font-size: 12px;
    line-height: 1.5;
}

.local-open-notice[hidden] {
    display: none;
}

.local-open-notice i,
.local-open-notice a {
    color: var(--office-blue);
}

.start-section {
    min-width: 0;
}

.start-section-heading {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.start-section-heading h2 {
    margin: 0;
    color: #252936;
    font-size: 15px;
    font-weight: 750;
}

.start-section-heading span {
    color: #979dac;
    font-size: 11px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.template-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    padding: 10px;
    border: 1px solid #e0e3ea;
    border-radius: 10px;
    color: #313643;
    background: rgba(255, 255, 255, 0.92);
    text-align: left;
    box-shadow: 0 5px 16px rgba(30, 35, 55, 0.045);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
    scroll-margin-top: calc(var(--nav-height) + 10px);
}

.template-card:hover {
    border-color: #bfc3ee;
    box-shadow: 0 10px 24px rgba(31, 35, 171, 0.11);
    transform: translateY(-2px);
}

.template-card > span:last-child,
.open-action span,
.recent-empty span {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.template-card strong,
.open-action strong,
.recent-empty strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-card small,
.open-action small,
.recent-empty small {
    overflow: hidden;
    color: #8b91a0;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-preview {
    position: relative;
    height: 70px;
    overflow: hidden;
    border: 1px solid #e1e4eb;
    border-radius: 6px;
    background: #fff;
}

.template-preview-blank {
    display: grid;
    place-items: center;
    color: #b4b9c5;
    font-size: 27px;
}

.template-preview-landing {
    background: linear-gradient(140deg, #eef0ff 0 52%, #fff 52%);
}

.template-preview-landing i,
.template-preview-landing b,
.template-preview-landing em,
.template-preview-article i,
.template-preview-campaign b {
    position: absolute;
    display: block;
    border-radius: 999px;
}

.template-preview-landing i {
    top: 15px;
    left: 12px;
    width: 54px;
    height: 6px;
    background: #3438ba;
}

.template-preview-landing b {
    top: 27px;
    left: 12px;
    width: 38px;
    height: 3px;
    background: #aeb3c9;
}

.template-preview-landing em {
    top: 39px;
    left: 12px;
    width: 25px;
    height: 10px;
    background: #1f23ab;
}

.template-preview-article i {
    left: 14px;
    right: 14px;
    height: 3px;
    background: #d6d9e1;
}

.template-preview-article i:nth-child(1) { top: 14px; right: 34px; height: 7px; background: #303544; }
.template-preview-article i:nth-child(2) { top: 31px; }
.template-preview-article i:nth-child(3) { top: 41px; }
.template-preview-article i:nth-child(4) { top: 51px; right: 30px; }

.template-preview-campaign {
    color: #fff;
    background: linear-gradient(145deg, #1f23ab, #8b5cf6);
}

.template-preview-campaign i {
    position: absolute;
    top: 14px;
    left: 12px;
    font-size: 18px;
    font-style: normal;
    font-weight: 900;
}

.template-preview-campaign b {
    left: 12px;
    bottom: 12px;
    width: 32px;
    height: 9px;
    background: #fff;
}

.start-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    gap: 20px;
}

.open-section,
.recent-section {
    padding: 16px;
    border: 1px solid #e0e3ea;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 18px rgba(30, 35, 55, 0.04);
}

.open-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.open-action {
    min-width: 0;
    min-height: 58px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid #e0e3ea;
    border-radius: 8px;
    color: #383d4b;
    background: #fff;
    text-align: left;
}

.open-action i {
    color: #636a7b;
    text-align: center;
    font-size: 19px;
}

.open-action.primary {
    border-color: #d5d8f6;
    background: #f7f7ff;
}

.open-action.primary i {
    color: var(--office-blue);
}

.url-open-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 9px;
}

.url-open-row .url-input,
.url-open-row .url-import-btn {
    min-height: 38px;
    height: 38px;
    border-radius: 7px;
    font-size: 12px;
}

.recent-section {
    display: flex;
    flex-direction: column;
}

.recent-section .restore-draft-card,
.recent-empty {
    flex: 1;
    min-height: 105px;
}

.recent-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    border: 1px dashed #dfe2e9;
    border-radius: 8px;
    color: #9aa0ad;
    background: #fafbfc;
}

.recent-empty i {
    font-size: 21px;
}

.recent-empty[hidden] {
    display: none;
}

.workspace {
    min-height: calc(100vh - var(--nav-height) - var(--site-footer-height));
}

.workspace-modebar {
    min-height: 44px;
    height: 44px;
    padding: 5px 14px;
}

.workspace-mode-tabs {
    grid-template-columns: repeat(4, auto);
}

.workspace-mode-btn {
    min-height: 28px;
    font-size: 12px;
}

.preview-shell,
.document-editor-shell,
.visual-designer-shell,
.source-editor-shell {
    height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 44px - var(--office-status-height));
}

.preview-shell,
.document-editor-shell {
    transition: transform 0.16s ease;
    transform-origin: top center;
}

.visual-designer-shell,
.source-editor-shell {
    display: none;
}

body.designer-editing .visual-designer-shell {
    display: grid;
}

body.designer-editing .preview-shell,
body.designer-editing .document-editor-shell,
body.source-editing .preview-shell,
body.source-editing .document-editor-shell {
    display: none;
}

body.source-editing .source-editor-shell {
    display: flex;
}

.visual-designer-shell {
    grid-template-columns: 230px minmax(0, 1fr) 270px;
    overflow: hidden;
    background: #eef0f4;
}

body.designer-left-collapsed .visual-designer-shell {
    grid-template-columns: 0 minmax(0, 1fr) 270px;
}

body.designer-right-collapsed .visual-designer-shell {
    grid-template-columns: 230px minmax(0, 1fr) 0;
}

body.designer-left-collapsed.designer-right-collapsed .visual-designer-shell {
    grid-template-columns: 0 minmax(0, 1fr) 0;
}

.designer-panel {
    min-width: 0;
    overflow: hidden;
    border-right: 1px solid var(--office-border);
    background: #fff;
}

.designer-right-panel {
    border-right: 0;
    border-left: 1px solid var(--office-border);
}

.designer-panel-tabs {
    height: 38px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    border-bottom: 1px solid var(--office-border);
    background: #f7f8fa;
}

.designer-panel-tab {
    border: 0;
    border-radius: 5px;
    color: #6b7280;
    background: transparent;
    font-size: 12px;
}

.designer-panel-tab.active {
    color: var(--office-blue);
    background: #fff;
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.09);
    font-weight: 700;
}

.designer-panel-content {
    display: none;
    height: calc(100% - 38px);
    overflow: auto;
}

.designer-panel-content.active {
    display: block;
}

.designer-canvas-wrap {
    min-width: 0;
    padding: 14px;
    overflow: hidden;
}

#gjs,
#gjs > .gjs-editor {
    height: 100%;
}

.gjs-one-bg {
    background-color: #fff;
}

.gjs-two-color {
    color: #343946;
}

.gjs-three-bg,
.gjs-four-color-h:hover {
    background-color: var(--office-blue);
}

.gjs-four-color,
.gjs-four-color-h:hover {
    color: var(--office-blue);
}

.gjs-cv-canvas {
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    box-shadow: 0 4px 20px rgba(17, 24, 39, 0.12);
}

.gjs-blocks-c {
    padding: 8px;
}

.gjs-block {
    width: calc(50% - 8px);
    min-height: 68px;
    margin: 4px;
    padding: 8px 5px;
    border: 1px solid #e1e4ea;
    border-radius: 7px;
    color: #596071;
    box-shadow: none;
    font-size: 10px;
}

.gjs-block:hover {
    color: var(--office-blue);
    border-color: #cdd1f5;
    box-shadow: 0 4px 12px rgba(31, 35, 171, 0.09);
}

.gjs-block__media {
    margin-bottom: 5px;
}

.gjs-sm-sector-title,
.gjs-layer-title {
    padding: 9px;
    border-bottom: 1px solid #eceef3;
    background: #f8f9fb;
    font-size: 11px;
}

.gjs-field,
.gjs-sm-field,
.gjs-clm-tags #gjs-clm-new {
    color: #343946;
    background-color: #f2f3f6;
}

.source-editor-shell {
    flex-direction: column;
    background: #1d2027;
}

.source-toolbar {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 14px;
    border-bottom: 1px solid #343844;
    color: #c8ccd6;
    background: #252932;
    font-size: 12px;
}

.source-toolbar button {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #484e5d;
    border-radius: 5px;
    color: #e3e6ee;
    background: #313642;
}

.source-toolbar button:hover {
    border-color: #7a83df;
    background: #3b4160;
}

#sourceEditor {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 20px 24px 70px;
    border: 0;
    resize: none;
    outline: none;
    color: #d9deea;
    background: #1d2027;
    caret-color: #8b93ff;
    tab-size: 2;
    font: 13px/1.7 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.office-statusbar {
    height: var(--office-status-height);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
    border-top: 1px solid var(--office-border);
    color: #727987;
    background: #fff;
    font-size: 10px;
}

.office-statusbar > span + span {
    padding-left: 14px;
    border-left: 1px solid #e7e9ee;
}

.office-statusbar .status-spacer {
    flex: 1;
    padding: 0;
    border: 0;
}

.find-replace-grid {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px 12px;
    align-items: center;
}

.find-replace-grid input {
    min-width: 0;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #d9dce5;
    border-radius: 7px;
    outline: 0;
}

.find-replace-grid input:focus {
    border-color: var(--office-blue);
    box-shadow: 0 0 0 3px rgba(31, 35, 171, 0.08);
}

.find-result {
    grid-column: 2;
    min-height: 20px;
    margin: 0;
    color: #6b7280;
    font-size: 12px;
}

.history-list {
    max-height: 340px;
    display: grid;
    gap: 7px;
    overflow: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e4e6ec;
    border-radius: 7px;
    background: #fafbfc;
}

.history-item strong,
.history-item small {
    display: block;
}

.history-item small {
    margin-top: 3px;
    color: #8a919f;
}

.history-item button {
    flex: none;
    padding: 6px 10px;
    border: 1px solid #d9dcfa;
    border-radius: 5px;
    color: var(--office-blue);
    background: #f3f4ff;
}

body.text-editing .preview-shell {
    height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 52px - var(--office-status-height));
}

/* Professional desktop treatment: restrained, flat, and task-first. */
:root {
    --office-blue: #2457a7;
    --office-blue-soft: #edf3fb;
    --office-border: #dfe2e7;
    --office-panel: #f5f6f7;
}

.topbar,
.office-ribbon,
.workspace-modebar {
    box-shadow: none;
}

.topbar {
    background: #f7f7f7;
    border-bottom-color: #d9dce1;
}

.brand-mark {
    border-radius: 3px;
    background: #2457a7;
}

.topbar .nav-link,
.topbar .tool-btn,
.ribbon-command,
.ribbon-icon-btn,
.ribbon-select {
    border-radius: 3px;
}

.office-ribbon {
    border-bottom-color: #d9dce1;
    background: #fbfbfb;
}

.ribbon-tabs {
    background: #f7f7f7;
}

.ribbon-panels {
    background: #fff;
}

body:not(.editor-ready) .office-ribbon,
body:not(.editor-ready) .action-center,
body:not(.editor-ready) .document-meta,
body:not(.editor-ready) .nav-actions {
    display: none;
}

body:not(.editor-ready) .app {
    padding-top: var(--titlebar-height);
}

body:not(.editor-ready) .topbar {
    grid-template-columns: 1fr;
    padding-right: 26px;
    padding-left: 26px;
}

body:not(.editor-ready) .home-view {
    min-height: max(500px, calc(100vh - var(--titlebar-height) - var(--site-footer-height)));
}

.home-view {
    padding: 34px 28px 42px;
    background: #f4f5f7;
}

.start-center {
    width: min(1100px, 100%);
    gap: 28px;
}

.start-heading {
    align-items: center;
    padding: 0;
}

.start-kicker {
    margin-bottom: 5px;
    color: #777e89;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
}

.start-heading h1 {
    color: #1f2329;
    font-size: 32px;
    font-weight: 680;
    letter-spacing: -0.025em;
}

.start-heading p {
    margin-top: 7px;
    color: #7a818c;
    font-size: 13px;
}

.start-primary {
    min-height: 36px;
    padding: 0 16px;
    border-color: #2457a7;
    border-radius: 3px;
    background: #2457a7;
    box-shadow: none;
    font-size: 12px;
    font-weight: 650;
}

.start-primary:hover {
    background: #1d4789;
    transform: none;
}

.local-open-notice {
    padding: 9px 12px;
    border: 0;
    border-left: 3px solid #2457a7;
    border-radius: 0;
    color: #59616d;
    background: #edf1f6;
}

.start-section-heading {
    margin-bottom: 12px;
}

.start-section-heading h2 {
    color: #30343a;
    font-size: 14px;
    font-weight: 680;
}

.start-section-heading span {
    color: #979da6;
}

.template-grid {
    grid-template-columns: repeat(4, 168px);
    gap: 22px;
    justify-content: start;
}

.template-card {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 9px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.template-card:hover {
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

.template-card:hover .template-preview {
    border-color: #2457a7;
    box-shadow: 0 0 0 1px #2457a7;
}

.template-card > span:last-child {
    padding: 0 2px;
}

.template-card strong {
    font-size: 12px;
    font-weight: 650;
}

.template-card small {
    font-size: 10px;
}

.template-preview {
    width: 100%;
    height: 104px;
    border-color: #d8dce2;
    border-radius: 2px;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.template-preview-landing {
    background: #eef1f4;
}

.template-preview-landing i,
.template-preview-landing em {
    background: #2457a7;
}

.template-preview-campaign {
    background: #343a46;
}

.template-preview-campaign b {
    border-radius: 2px;
}

.start-lower-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 34px;
    padding-top: 22px;
    border-top: 1px solid #d9dde3;
}

.open-section,
.recent-section {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.recent-section {
    padding-left: 30px;
    border-left: 1px solid #d9dde3;
}

.open-actions {
    gap: 8px;
}

.open-action {
    min-height: 54px;
    border-color: #d5d9df;
    border-radius: 3px;
    background: #fff;
}

.open-action:hover {
    border-color: #9aa6b8;
    background: #fafbfc;
}

.open-action.primary {
    border-color: #bfc9d8;
    background: #fff;
}

.url-open-row .url-input,
.url-open-row .url-import-btn {
    border-radius: 3px;
}

.restore-draft-card {
    min-height: 72px;
    padding: 12px;
    border-color: #d5d9df;
    border-radius: 3px;
    color: #3f4752;
    background: #fff;
}

.restore-draft-card:hover {
    border-color: #9aa6b8;
    background: #fafbfc;
}

.recent-section .restore-draft-card,
.recent-empty {
    min-height: 88px;
}

.recent-empty {
    border-color: #ccd1d8;
    border-radius: 3px;
    background: transparent;
}

.workspace-modebar {
    border-bottom-color: #d9dce1;
    background: #f7f7f7;
}

.workspace-mode-tabs {
    gap: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.workspace-mode-btn {
    min-height: 32px;
    padding: 0 14px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    font-weight: 600;
}

.workspace-mode-btn:hover {
    background: #eceef1;
}

.workspace-mode-btn.active {
    color: #2457a7;
    border-bottom-color: #2457a7;
    background: transparent;
    box-shadow: none;
}

body.editor-ready {
    --site-footer-height: 32px;
}

body.editor-ready .site-footer {
    height: 32px;
    min-height: 32px;
    padding: 5px 18px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 10px;
    line-height: 1.35;
}

body.editor-ready .site-footer p {
    margin: 0;
}

body.editor-ready .site-footer-copyright {
    display: flex;
}

.topbar .tool-btn:hover {
    transform: none;
}

.topbar .tool-btn.active {
    color: #2457a7;
    border: 1px solid #c7d3e4;
    background: #e9eff7;
    box-shadow: none;
    transform: none;
}

.topbar #textEditBtn {
    display: none;
}

.document-editor-shell .jodit-toolbar__box,
.document-editor-shell .jodit-status-bar {
    display: none !important;
}

.document-editor-shell .jodit-container,
.document-editor-shell .jodit-workplace {
    height: 100% !important;
}

.document-editor-shell .jodit-workplace {
    border: 0 !important;
}

.print-frame {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.designer-panel-tabs {
    padding: 0;
    background: #f7f7f7;
}

.designer-panel-tab {
    border-radius: 0;
    border-bottom: 2px solid transparent;
}

.designer-panel-tab.active {
    border-bottom-color: #2457a7;
    background: #fff;
    box-shadow: none;
}

.gjs-cv-canvas {
    border: 1px solid #d8dce2;
    border-radius: 2px;
    box-shadow: none;
}

.gjs-block {
    border-radius: 3px;
}

.gjs-block:hover {
    border-color: #93a5bd;
    box-shadow: none;
}

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: minmax(220px, 1fr) auto;
    }

    .nav-actions {
        display: none;
    }

    .visual-designer-shell {
        grid-template-columns: 200px minmax(0, 1fr) 230px;
    }

    .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    :root {
        --titlebar-height: 50px;
        --ribbon-height: 96px;
        --nav-height: 146px;
        --site-footer-height: 106px;
    }

    body.editor-ready {
        --site-footer-height: 66px;
    }

    body.editor-ready .site-footer {
        height: 66px;
        min-height: 66px;
        padding: 9px 12px;
        display: block;
    }

    .topbar {
        height: var(--titlebar-height);
        min-height: var(--titlebar-height);
        grid-template-columns: 1fr auto;
        padding: 5px 10px;
    }

    .document-meta {
        display: none;
    }

    .action-center {
        grid-column: auto;
        grid-row: auto;
        order: initial;
        gap: 0;
        padding: 0;
    }

    .topbar .tool-btn {
        min-width: 30px;
        padding: 6px;
    }

    .topbar .tool-btn span {
        display: none;
    }

    .topbar .tool-btn:nth-child(1),
    .topbar .tool-btn:nth-child(5),
    .topbar .tool-btn:nth-child(6) {
        display: none;
    }

    .office-ribbon {
        top: var(--titlebar-height);
        height: var(--ribbon-height);
    }

    .home-view {
        min-height: max(560px, calc(100vh - var(--nav-height)));
        padding: 14px 12px 26px;
    }

    .start-center {
        gap: 14px;
    }

    .start-heading {
        align-items: flex-start;
        gap: 12px;
    }

    .start-heading h1 {
        font-size: 24px;
    }

    .start-heading p {
        margin-top: 5px;
        font-size: 12px;
    }

    .start-primary {
        min-height: 38px;
        padding: 0 13px;
        font-size: 11px;
    }

    .template-grid,
    .start-lower-grid {
        grid-template-columns: 1fr;
    }

    .template-grid {
        display: flex;
        gap: 9px;
        overflow-x: auto;
        padding-bottom: 3px;
        scroll-snap-type: x proximity;
    }

    .template-card {
        min-width: 228px;
        grid-template-columns: 76px minmax(0, 1fr);
        scroll-snap-align: start;
    }

    .template-preview {
        height: 58px;
    }

    .start-lower-grid {
        gap: 12px;
    }

    .open-section,
    .recent-section {
        padding: 13px;
    }

    .recent-section .restore-draft-card,
    .recent-empty {
        min-height: 74px;
    }

    .ribbon-tabs {
        height: 28px;
        padding: 0 7px;
    }

    .ribbon-tab {
        min-width: 52px;
        padding: 0 8px;
    }

    .ribbon-panels {
        height: 68px;
    }

    .ribbon-panel {
        padding: 3px 6px;
    }

    .ribbon-group {
        padding-right: 6px;
        padding-left: 6px;
    }

    .ribbon-command {
        height: 43px;
    }

    .workspace-modebar {
        height: 70px;
        min-height: 70px;
        padding: 6px 8px;
    }

    .workspace-mode-tabs {
        grid-template-columns: repeat(4, 1fr);
    }

    .workspace-mode-btn {
        min-width: 0;
        padding: 0 5px;
        font-size: 10px;
    }

    .workspace-mode-btn i {
        display: none;
    }

    .preview-shell,
    .document-editor-shell,
    .visual-designer-shell,
    .source-editor-shell {
        height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 70px - var(--office-status-height));
    }

    .visual-designer-shell,
    body.designer-left-collapsed .visual-designer-shell,
    body.designer-right-collapsed .visual-designer-shell,
    body.designer-left-collapsed.designer-right-collapsed .visual-designer-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .designer-panel {
        position: fixed;
        z-index: 60;
        top: var(--nav-height);
        bottom: var(--site-footer-height);
        width: min(300px, 84vw);
        box-shadow: 12px 0 30px rgba(17, 24, 39, 0.18);
    }

    .designer-left-panel {
        left: 0;
        transform: translateX(-102%);
    }

    .designer-right-panel {
        right: 0;
        transform: translateX(102%);
    }

    body:not(.designer-left-collapsed) .designer-left-panel {
        transform: translateX(0);
    }

    body:not(.designer-right-collapsed) .designer-right-panel {
        transform: translateX(0);
    }

    .designer-canvas-wrap {
        padding: 7px;
    }

    .office-statusbar {
        gap: 8px;
        padding: 0 8px;
    }

    #selectionStatus,
    #autosaveStatus {
        display: none;
    }

    .source-toolbar {
        padding: 5px 8px;
    }

    .source-toolbar button {
        padding: 0 7px;
        font-size: 10px;
    }

    #sourceEditor {
        padding: 14px 12px 60px;
        font-size: 12px;
    }
}

@media (max-width: 520px) {
    .start-heading {
        display: grid;
    }

    .start-primary {
        width: 100%;
    }

    .open-actions {
        grid-template-columns: 1fr;
    }

    .url-open-row {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 420px) {
    :root {
        --titlebar-height: 40px;
        --ribbon-height: 78px;
        --nav-height: 118px;
        --office-status-height: 22px;
    }

    body.editor-ready {
        --site-footer-height: 40px;
    }

    .topbar {
        height: 40px;
        min-height: 40px;
        padding-top: 3px;
        padding-bottom: 3px;
    }

    .office-ribbon {
        top: 40px;
        height: 78px;
    }

    .ribbon-tabs {
        height: 24px;
    }

    .ribbon-panels {
        height: 54px;
    }

    .ribbon-panel {
        padding-top: 1px;
        padding-bottom: 1px;
    }

    .ribbon-group {
        padding-top: 0;
        padding-bottom: 0;
    }

    .ribbon-group-label {
        display: none;
    }

    .ribbon-command {
        height: 48px;
        gap: 2px;
    }

    .ribbon-command i {
        font-size: 14px;
    }

    .workspace-modebar {
        height: 34px;
        min-height: 34px;
        padding-top: 2px;
        padding-bottom: 2px;
    }

    .workspace-status {
        display: none;
    }

    .preview-shell,
    .document-editor-shell,
    .visual-designer-shell,
    .source-editor-shell {
        height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 34px - var(--office-status-height));
        min-height: 80px;
    }

    .office-statusbar {
        height: var(--office-status-height);
    }

    body.editor-ready .site-footer {
        height: 40px;
        min-height: 40px;
        padding: 3px 8px;
        font-size: 8px;
        line-height: 1.2;
    }
}

@media (max-height: 520px) {
    .home-view {
        min-height: 500px;
        padding-top: 12px;
    }

    .start-center {
        gap: 11px;
    }

    .start-heading h1 {
        font-size: 22px;
    }

    .start-heading p,
    .start-kicker {
        display: none;
    }

    .template-preview {
        height: 52px;
    }
}

/* Reference-led shell: ONLYOFFICE hierarchy, Silex canvas, Fluent motion. */
:root {
    --motion-faster: 83ms;
    --motion-fast: 167ms;
    --motion-normal: 250ms;
    --motion-enter: cubic-bezier(0, 0, 0, 1);
    --shell-ink: #20242b;
    --shell-muted: #717884;
    --shell-blue: #2463a7;
    --shell-sidebar: #202832;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.home-view {
    padding: 28px;
    background: #e9edf2;
}

.start-center {
    width: min(1180px, 100%);
    min-height: 560px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid #d8dde4;
    background: #fff;
    animation: shell-enter var(--motion-fast) var(--motion-enter) both;
}

.start-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 34px 26px;
    color: #fff;
    background: var(--shell-sidebar);
}

.start-sidebar .start-heading {
    display: block;
    padding: 0;
}

.start-sidebar .start-kicker {
    margin: 0 0 12px;
    color: #91b7e3;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
}

.start-sidebar .start-heading h1 {
    color: #fff;
    font-size: 30px;
    font-weight: 660;
    letter-spacing: -.025em;
}

.start-sidebar .start-heading p {
    margin-top: 10px;
    color: #aeb8c4;
    font-size: 12px;
    line-height: 1.7;
}

.start-sidebar-actions {
    display: grid;
    gap: 7px;
}

.start-sidebar .start-primary,
.start-side-action {
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #eaf0f6;
    background: transparent;
    box-shadow: none;
    text-align: left;
    transition: background var(--motion-faster) linear, border-color var(--motion-faster) linear;
}

.start-sidebar .start-primary {
    border-color: #3978bb;
    background: #2869ad;
}

.start-side-action {
    border-color: #35414e;
}

.start-sidebar .start-primary:hover,
.start-side-action:hover {
    border-color: #4c8acb;
    background: #2a3440;
    transform: none;
}

.start-sidebar .start-primary:hover {
    background: #3277bd;
}

.start-sidebar .start-primary > i,
.start-side-action > i {
    width: 22px;
    color: #9fc4ec;
    text-align: center;
    font-size: 17px;
}

.start-sidebar .start-primary span,
.start-side-action span {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.start-sidebar .start-primary strong,
.start-side-action strong {
    font-size: 12px;
    font-weight: 650;
}

.start-sidebar .start-primary small,
.start-side-action small {
    color: #9da9b6;
    font-size: 10px;
}

.start-sidebar .url-open-row {
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 5px;
}

.start-sidebar .url-input,
.start-sidebar .url-import-btn {
    min-height: 36px;
    height: 36px;
    border-color: #3a4552;
    border-radius: 3px;
    color: #e5eaf0;
    background: #171d25;
    box-shadow: none;
}

.start-sidebar .url-input {
    padding: 0 10px;
    font-size: 11px;
}

.start-sidebar .url-input::placeholder {
    color: #74808d;
}

.start-sidebar .url-import-btn {
    padding: 0;
    color: #a8c9ec;
}

.start-sidebar .url-import-btn:hover {
    background: #2a3440;
}

.start-sidebar .local-open-notice {
    margin-top: auto;
    padding: 10px 0 0;
    border: 0;
    border-top: 1px solid #35414e;
    color: #9da9b6;
    background: transparent;
    font-size: 10px;
}

.start-sidebar .local-open-notice a,
.start-sidebar .local-open-notice i {
    color: #91b7e3;
}

.start-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 40px 44px 32px;
    background: #fff;
}

.start-main-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.start-main-heading span {
    color: var(--shell-blue);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .08em;
}

.start-main-heading h2 {
    margin: 5px 0 0;
    color: var(--shell-ink);
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.start-main-heading p {
    margin: 0;
    color: #8a919b;
    font-size: 11px;
}

.start-main .template-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    overflow: visible;
}

.start-main .template-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: left;
}

.start-main .template-preview {
    width: 100%;
    height: 128px;
    border: 1px solid #d8dde4;
    border-radius: 2px;
    transition: border-color var(--motion-faster) linear, transform var(--motion-fast) var(--motion-enter);
}

.start-main .template-card:hover .template-preview,
.start-main .template-card:focus-visible .template-preview {
    border-color: var(--shell-blue);
    transform: translateY(-2px);
    box-shadow: none;
}

.start-main .template-card strong {
    color: #353a42;
    font-size: 12px;
}

.start-main .template-card small {
    color: #89909a;
    font-size: 10px;
}

.start-main .recent-section {
    margin-top: auto;
    padding: 24px 0 0;
    border: 0;
    border-top: 1px solid #e0e4e9;
}

.start-main .recent-section .restore-draft-card,
.start-main .recent-empty {
    min-height: 62px;
    border: 1px solid #dce1e7;
    border-radius: 3px;
    background: #f8f9fa;
}

.designer-viewport-tools {
    display: none;
    align-items: center;
    gap: 4px;
    color: #626a75;
    font-size: 10px;
}

body.designer-editing .designer-viewport-tools {
    display: flex;
}

.designer-device-switch {
    display: flex;
    border: 1px solid #d7dce3;
    border-radius: 3px;
    overflow: hidden;
}

.designer-viewport-tools button {
    min-width: 28px;
    height: 26px;
    padding: 0 7px;
    border: 0;
    border-radius: 0;
    color: #626a75;
    background: #fff;
    font-size: 10px;
}

.designer-device-switch button + button {
    border-left: 1px solid #d7dce3;
}

.designer-viewport-tools button:hover,
.designer-viewport-tools button.active {
    color: var(--shell-blue);
    background: #eaf1f8;
}

.workspace-mode-btn:focus-visible,
.designer-viewport-tools button:focus-visible,
.start-main .template-card:focus-visible,
.start-sidebar button:focus-visible {
    outline: 2px solid #79a7d6;
    outline-offset: -2px;
}

.designer-tool-divider {
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: #d7dce3;
}

body.designer-editing,
body.source-editing,
body.preview-editing,
body.page-editing {
    --ribbon-height: 0px;
    --nav-height: var(--titlebar-height);
}

body.designer-editing .office-ribbon,
body.source-editing .office-ribbon,
body.preview-editing .office-ribbon,
body.page-editing .office-ribbon {
    display: none;
}

body.designer-editing .app,
body.source-editing .app,
body.preview-editing .app,
body.page-editing .app {
    padding-top: var(--titlebar-height);
}

body.designer-editing .visual-designer-shell,
body.source-editing .source-editor-shell,
body.preview-editing .preview-shell,
body.page-editing .preview-shell,
body.document-editing .document-editor-shell {
    animation: workspace-enter var(--motion-fast) var(--motion-enter) both;
}

.visual-designer-shell {
    transition: grid-template-columns var(--motion-fast) var(--motion-enter);
}

@keyframes shell-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes workspace-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 900px) {
    .home-view {
        padding: 18px;
    }

    .start-center {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .start-sidebar {
        padding: 28px 20px;
    }

    .start-main {
        padding: 32px 28px 26px;
    }

    .start-main .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .start-main .template-preview {
        height: 112px;
    }
}

@media (max-width: 680px) {
    .home-view {
        padding: 0;
    }

    .start-center {
        display: block;
        min-height: 0;
        border: 0;
    }

    .start-sidebar {
        padding: 22px 16px;
        gap: 17px;
    }

    .start-sidebar-actions {
        grid-template-columns: 1fr 1fr;
    }

    .start-sidebar .start-primary {
        grid-column: 1 / -1;
    }

    .start-main {
        padding: 26px 16px 30px;
    }

    .start-main-heading {
        align-items: flex-start;
        margin-bottom: 20px;
    }

    .start-main-heading p {
        display: none;
    }

    .start-main .template-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 12px;
    }

    .start-main .template-card {
        min-width: 0;
        grid-template-columns: 1fr;
    }

    .start-main .template-preview {
        height: 100px;
    }

    body.designer-editing .workspace-status {
        display: none;
    }

    .designer-viewport-tools {
        margin-left: auto;
    }
}

@media (max-width: 430px) {
    .start-sidebar-actions {
        grid-template-columns: 1fr;
    }

    .start-sidebar .start-primary {
        grid-column: auto;
    }

    .start-main .template-grid {
        grid-template-columns: 1fr 1fr;
    }

    .designer-viewport-tools #canvasZoomOut,
    .designer-viewport-tools #canvasZoomIn,
    .designer-viewport-tools #canvasZoomValue,
    .designer-tool-divider {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media (min-width: 560px) and (max-width: 680px) and (max-height: 420px) {
    .start-sidebar {
        gap: 10px;
        padding: 14px 16px;
    }

    .start-sidebar .start-heading h1 {
        font-size: 24px;
    }

    .start-sidebar-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .start-sidebar .start-primary {
        grid-column: auto;
    }

    .start-sidebar .start-primary,
    .start-side-action {
        min-height: 52px;
        padding: 7px 9px;
    }

    .start-main {
        padding-top: 20px;
    }
}

/* Refined neutral visual system: typography and space before decoration. */
:root {
    --titlebar-height: 48px;
    --ribbon-height: 82px;
    --nav-height: 130px;
    --office-status-height: 24px;
    --refined-bg: #f6f6f4;
    --refined-surface: #fbfbfa;
    --refined-panel: #f1f1ef;
    --refined-canvas: #f0f0ee;
    --refined-line: #e3e3df;
    --refined-line-strong: #d3d3ce;
    --refined-text: #20201f;
    --refined-muted: #74746e;
    --refined-faint: #9a9a94;
    --refined-brand: #1f23ab;
    --refined-brand-hover: #191d91;
    --refined-brand-soft: #eef0ff;
    --refined-brand-line: #c9cdfa;
    --refined-active: var(--refined-brand);
    --refined-focus: #8f94e8;
    --office-blue: var(--refined-brand);
    --office-blue-soft: var(--refined-brand-soft);
    --shell-blue: var(--refined-brand);
}

html,
body,
button,
input,
select,
textarea {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
    color: var(--refined-text);
    background: var(--refined-bg);
}

.topbar {
    min-height: 48px;
    height: 48px;
    padding: 5px 18px;
    border-bottom: 1px solid var(--refined-line);
    background: rgba(251, 251, 250, .96);
}

.brand {
    gap: 11px;
}

.brand-mark {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: #fff;
    background: var(--refined-brand);
    font-size: 12px;
    font-weight: 750;
}

.brand-text {
    color: var(--refined-text);
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.document-meta {
    gap: 0;
    padding-left: 12px;
    border-left-color: var(--refined-line);
}

.document-meta strong {
    color: #343431;
    font-size: 12px;
    font-weight: 600;
}

.document-meta span {
    color: var(--refined-faint);
    font-size: 9px;
}

.action-center {
    gap: 1px;
}

.topbar .tool-btn {
    min-width: 30px;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 6px;
    color: #62625d;
}

.topbar .tool-btn span {
    display: none;
}

.topbar .ai-tool-btn {
    width: auto;
    min-width: 82px;
    padding: 0 11px;
    gap: 7px;
    color: var(--refined-brand);
    background: var(--refined-brand-soft);
    font-weight: 650;
}

.topbar .ai-tool-btn span {
    display: inline;
    font-size: 11px;
    letter-spacing: -.01em;
}

.topbar .ai-tool-btn:hover,
.topbar .ai-tool-btn.active {
    color: #fff;
    background: var(--refined-brand);
}

.topbar .ai-tool-btn:disabled {
    color: #8b8b86;
    background: #eeeeeb;
}

.topbar .tool-btn i {
    font-size: 12px;
}

.topbar .tool-btn:hover {
    color: var(--refined-text);
    border-color: transparent;
    background: #ecece9;
}

.topbar .tool-btn.active {
    color: var(--refined-brand);
    border-color: transparent;
    background: var(--refined-brand-soft);
}

.topbar .nav-link {
    min-height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    color: #666660;
    background: transparent;
    font-size: 11px;
}

.topbar .nav-link:hover {
    color: var(--refined-text);
    background: #ecece9;
}

.topbar #bookmarkBtn {
    display: none;
}

body:not(.editor-ready) .topbar {
    border-bottom-color: transparent;
    background: var(--refined-bg);
}

.home-view {
    padding: 46px 32px 54px;
    background: var(--refined-bg);
}

.start-center {
    width: min(1080px, 100%);
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    animation: workspace-enter var(--motion-fast) var(--motion-enter) both;
}

.start-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    grid-template-areas:
        "heading url"
        "actions actions"
        "notice notice";
    align-items: end;
    gap: 24px 34px;
    padding: 0 0 34px;
    color: var(--refined-text);
    border-bottom: 1px solid var(--refined-line);
    background: transparent;
}

.start-sidebar .start-heading {
    grid-area: heading;
}

.start-sidebar .start-kicker {
    display: block;
    margin: 0 0 9px;
    color: var(--refined-faint);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .08em;
}

.start-sidebar .start-heading h1 {
    color: var(--refined-text);
    font-size: 32px;
    font-weight: 620;
    letter-spacing: -.035em;
}

.start-sidebar .start-heading p {
    display: block;
    margin-top: 9px;
    color: var(--refined-muted);
    font-size: 12px;
}

.start-sidebar-actions {
    grid-area: actions;
    display: flex;
    gap: 8px;
}

.start-sidebar .start-primary,
.start-side-action {
    width: auto;
    min-height: 44px;
    flex: 0 0 auto;
    gap: 9px;
    padding: 7px 13px;
    border: 1px solid var(--refined-line);
    border-radius: 7px;
    color: #4f4f4a;
    background: #fff;
    box-shadow: none;
}

.start-sidebar .start-primary {
    color: #fff;
    border-color: var(--refined-brand);
    background: var(--refined-brand);
}

.start-sidebar .start-primary:hover {
    border-color: var(--refined-brand-hover);
    background: var(--refined-brand-hover);
}

.start-side-action:hover {
    color: var(--refined-text);
    border-color: var(--refined-line-strong);
    background: #fdfdfc;
}

.start-sidebar .start-primary > i,
.start-side-action > i {
    width: 17px;
    color: inherit;
    font-size: 13px;
}

.start-sidebar .start-primary strong,
.start-side-action strong {
    font-size: 11px;
    font-weight: 620;
}

.start-sidebar .start-primary small,
.start-side-action small {
    display: none;
}

.start-sidebar .url-open-row {
    grid-area: url;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-self: end;
}

.start-sidebar .url-input,
.start-sidebar .url-import-btn {
    height: 36px;
    min-height: 36px;
    border: 1px solid var(--refined-line);
    border-radius: 7px;
    color: var(--refined-text);
    background: #fff;
}

.start-sidebar .url-input::placeholder {
    color: #aaa9a3;
}

.start-sidebar .url-import-btn {
    color: #666660;
}

.start-sidebar .url-import-btn:hover {
    color: var(--refined-text);
    background: #efefec;
}

.start-sidebar .local-open-notice {
    grid-area: notice;
    margin: -10px 0 0;
    padding: 0;
    border: 0;
    color: var(--refined-muted);
    background: transparent;
}

.start-sidebar .local-open-notice i,
.start-sidebar .local-open-notice a {
    color: #5f625f;
}

.start-main {
    display: flex;
    min-width: 0;
    padding: 34px 0 0;
    background: transparent;
}

.start-main-heading {
    align-items: flex-end;
    margin-bottom: 20px;
}

.start-main-heading span {
    display: none;
}

.start-main-heading h2 {
    margin: 0;
    color: var(--refined-text);
    font-size: 18px;
    font-weight: 620;
    letter-spacing: -.015em;
}

.start-main-heading p {
    color: var(--refined-faint);
    font-size: 10px;
}

.start-main .template-grid {
    gap: 18px;
}

.start-main .template-card {
    gap: 10px;
}

.start-main .template-preview {
    height: 142px;
    border: 1px solid var(--refined-line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(30, 30, 28, .025);
}

.start-main .template-card:hover .template-preview,
.start-main .template-card:focus-visible .template-preview {
    border-color: var(--refined-brand-line);
    transform: none;
}

.template-preview-landing {
    background: #eeeee9;
}

.template-preview-landing i,
.template-preview-landing em {
    background: #383834;
}

.template-preview-campaign {
    color: #343430;
    background: #e8e3d9;
}

.template-preview-campaign b {
    background: #8b806e;
}

.start-main .template-card strong {
    color: #383834;
    font-size: 11px;
    font-weight: 620;
}

.start-main .template-card small {
    color: var(--refined-faint);
    font-size: 9px;
}

.start-main .recent-section {
    margin-top: 40px;
    padding-top: 24px;
    border-top-color: var(--refined-line);
}

.start-main .recent-section .restore-draft-card,
.start-main .recent-empty {
    min-height: 52px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    color: #50504b;
    background: transparent;
}

.start-main .recent-section .restore-draft-card:hover {
    background: #ecece9;
}

.office-ribbon {
    top: 48px;
    height: 82px;
    border-bottom: 1px solid var(--refined-line);
    background: var(--refined-surface);
}

.ribbon-tabs {
    height: 28px;
    gap: 0;
    padding: 0 18px;
    border-top: 0;
    border-bottom: 1px solid #ededeb;
    background: var(--refined-surface);
}

.ribbon-tab {
    min-width: 52px;
    padding: 0 11px;
    border-bottom-width: 1px;
    color: #75756f;
    font-size: 10px;
}

.ribbon-tab:hover {
    color: var(--refined-text);
    background: transparent;
}

.ribbon-tab.active {
    color: var(--refined-brand);
    border-bottom-color: var(--refined-active);
    font-weight: 620;
}

.ribbon-panels {
    height: 54px;
    background: var(--refined-surface);
}

.ribbon-panel {
    height: 54px;
    padding: 4px 12px;
}

.ribbon-group {
    min-width: 68px;
    gap: 2px;
    padding: 0 12px;
    border-right: 0;
}

.ribbon-group-label {
    display: none;
}

.ribbon-command {
    min-width: 40px;
    height: 44px;
    gap: 3px;
    padding: 3px 6px;
    border: 0;
    border-radius: 6px;
    color: #5f5f59;
    font-size: 9px;
}

.ribbon-command i {
    color: #5f5f59;
    font-size: 14px;
}

.ribbon-command:hover,
.ribbon-icon-btn:hover {
    color: var(--refined-text);
    border-color: transparent;
    background: #ecece9;
}

.ribbon-command.active {
    color: var(--refined-brand);
    border-color: transparent;
    background: var(--refined-brand-soft);
}

.ribbon-command:hover i {
    color: var(--refined-text);
}

.ribbon-command.active i {
    color: var(--refined-brand);
}

.ribbon-font-group {
    min-width: 218px;
    grid-template-columns: 122px 50px;
    grid-template-rows: 23px 23px;
}

.ribbon-select {
    height: 22px;
    border: 0;
    border-radius: 5px;
    color: #4e4e49;
    background: #efefec;
    font-size: 10px;
}

.ribbon-icon-btn,
.ribbon-color-btn {
    width: 25px;
    height: 22px;
    border-radius: 5px;
    color: #5f5f59;
}

.workspace-modebar {
    min-height: 40px;
    height: 40px;
    padding: 4px 14px;
    border-bottom: 1px solid var(--refined-line);
    background: rgba(251, 251, 250, .97);
}

.workspace-mode-tabs {
    gap: 2px;
    padding: 2px;
    border-radius: 7px;
    background: #eeeeeb;
}

.workspace-mode-btn {
    min-height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 5px;
    color: #74746e;
    font-size: 10px;
    font-weight: 560;
}

.workspace-mode-btn:hover {
    color: var(--refined-text);
    background: rgba(255, 255, 255, .55);
}

.workspace-mode-btn.active {
    color: var(--refined-brand);
    border-bottom-color: transparent;
    background: var(--refined-brand-soft);
    box-shadow: none;
}

.workspace-status {
    color: var(--refined-faint);
    font-size: 10px;
}

.preview-shell,
.document-editor-shell,
.visual-designer-shell,
.source-editor-shell {
    height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 40px - var(--office-status-height));
}

.document-editor-shell .jodit-container,
.document-editor-shell .jodit-workplace {
    background: var(--refined-canvas);
}

.visual-designer-shell {
    grid-template-columns: 220px minmax(0, 1fr) 272px;
    background: var(--refined-canvas);
}

body.designer-left-collapsed .visual-designer-shell {
    grid-template-columns: 0 minmax(0, 1fr) 272px;
}

body.designer-right-collapsed .visual-designer-shell {
    grid-template-columns: 220px minmax(0, 1fr) 0;
}

.designer-panel {
    border-color: var(--refined-line);
    background: var(--refined-surface);
}

.designer-panel-tabs {
    height: 36px;
    border-bottom-color: var(--refined-line);
    background: var(--refined-surface);
}

.designer-panel-tab {
    border-bottom: 1px solid transparent;
    color: #85857f;
    font-size: 10px;
}

.designer-panel-tab.active {
    color: var(--refined-brand);
    border-bottom-color: var(--refined-active);
    background: transparent;
}

.designer-panel-content {
    height: calc(100% - 36px);
}

.designer-canvas-wrap {
    padding: 12px;
}

.gjs-cv-canvas {
    border: 1px solid var(--refined-line);
    border-radius: 3px;
    background: #fff;
}

.gjs-blocks-c {
    padding: 7px;
}

.gjs-block {
    width: calc(50% - 6px);
    min-height: 60px;
    margin: 3px;
    padding: 7px 4px;
    border-color: transparent;
    border-radius: 6px;
    color: #65655f;
    background: transparent;
    font-size: 9px;
}

.gjs-block:hover {
    color: var(--refined-text);
    border-color: transparent;
    background: #ebebe8;
}

.gjs-sm-sector-title,
.gjs-layer-title {
    padding: 8px 9px;
    border-bottom-color: #ecece9;
    color: #5e5e59;
    background: #f7f7f5;
    font-size: 10px;
}

.gjs-field,
.gjs-sm-field,
.gjs-clm-tags #gjs-clm-new {
    color: #474743;
    background-color: #eeeeeb;
}

.designer-device-switch {
    border-color: var(--refined-line);
    border-radius: 6px;
}

.designer-device-switch button + button {
    border-left-color: var(--refined-line);
}

.designer-viewport-tools button {
    color: #72726c;
    background: var(--refined-surface);
}

.designer-viewport-tools button:hover {
    color: var(--refined-text);
    background: #e9e9e6;
}

.designer-viewport-tools button.active {
    color: var(--refined-brand);
    background: var(--refined-brand-soft);
}

.workspace-mode-btn:focus-visible,
.designer-viewport-tools button:focus-visible,
.start-main .template-card:focus-visible,
.start-sidebar button:focus-visible,
.topbar button:focus-visible,
.ribbon-command:focus-visible {
    outline: 2px solid var(--refined-focus);
    outline-offset: 1px;
}

.office-statusbar {
    height: var(--office-status-height);
    gap: 10px;
    padding: 0 12px;
    border-top-color: var(--refined-line);
    color: #8b8b85;
    background: var(--refined-surface);
    font-size: 9px;
}

body.editor-ready {
    --site-footer-height: 30px;
}

body.editor-ready .site-footer {
    height: 30px;
    min-height: 30px;
    color: #999993;
    border-top-color: var(--refined-line);
    background: var(--refined-bg);
    font-size: 9px;
}

.site-footer {
    color: #92928c;
    border-top-color: var(--refined-line);
    background: var(--refined-bg);
}

.ai-panel {
    top: calc(var(--nav-height) + 10px);
    right: 12px;
    bottom: 12px;
    width: min(368px, calc(100vw - 24px));
    gap: 12px;
    padding: 16px;
    border-color: var(--refined-line);
    border-radius: 8px;
    color: var(--refined-text);
    background: var(--refined-surface);
    box-shadow: 0 14px 44px rgba(31, 31, 29, .14);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.ai-panel-title {
    color: var(--refined-text);
    font-size: 15px;
    font-weight: 650;
}

.ai-panel-close {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    color: var(--refined-muted);
    background: transparent;
}

.ai-panel-close:hover {
    color: var(--refined-text);
    background: #ecece9;
}

.ai-mode,
.ai-prompt {
    border-color: var(--refined-line);
    border-radius: 6px;
    color: var(--refined-text);
    background: #fff;
}

.ai-prompt:focus,
.ai-mode:focus {
    border-color: var(--refined-brand-line);
    outline: 2px solid var(--refined-brand-soft);
}

.ai-chip {
    border-color: var(--refined-line);
    border-radius: 6px;
    color: #555550;
    background: #fff;
    font-size: 11px;
    font-weight: 600;
}

.ai-chip:hover {
    color: var(--refined-brand);
    border-color: var(--refined-brand-line);
    background: var(--refined-brand-soft);
}

.ai-run {
    min-height: 42px;
    border-radius: 6px;
    color: #fff;
    background: var(--refined-brand);
    box-shadow: none;
    font-size: 13px;
    font-weight: 650;
}

.ai-run:hover:not(:disabled) {
    background: var(--refined-brand-hover);
}

.ai-status {
    color: var(--refined-muted);
    font-size: 11px;
}

@media (max-width: 900px) {
    .start-center {
        grid-template-columns: 1fr;
    }

    .start-main {
        padding-right: 0;
        padding-left: 0;
    }
}

@media (max-width: 680px) {
    :root {
        --titlebar-height: 46px;
        --ribbon-height: 86px;
        --nav-height: 132px;
    }

    .home-view {
        padding: 22px 16px 34px;
    }

    .start-sidebar {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas: "heading" "actions" "url" "notice";
        gap: 18px;
        padding-bottom: 26px;
    }

    .start-sidebar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .start-sidebar .start-primary {
        grid-column: 1 / -1;
    }

    .start-sidebar .start-primary,
    .start-side-action {
        width: 100%;
    }

    .start-main {
        padding-top: 26px;
    }

    .start-main .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .start-main .template-preview {
        height: 104px;
    }

    .workspace-modebar {
        height: 40px;
        min-height: 40px;
    }

    .preview-shell,
    .document-editor-shell,
    .visual-designer-shell,
    .source-editor-shell {
        height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 40px - var(--office-status-height));
    }
}

@media (max-width: 430px) {
    .start-sidebar-actions {
        grid-template-columns: 1fr;
    }

    .start-sidebar .start-primary {
        grid-column: auto;
    }
}

@media (max-height: 420px) {
    :root {
        --titlebar-height: 40px;
        --ribbon-height: 74px;
        --nav-height: 114px;
        --office-status-height: 20px;
    }

    body.editor-ready {
        --site-footer-height: 38px;
    }

    .topbar {
        height: 40px;
        min-height: 40px;
    }

    .office-ribbon {
        top: 40px;
        height: 74px;
    }

    .ribbon-panels {
        height: 46px;
    }

    .ribbon-panel {
        height: 46px;
    }

    .workspace-modebar {
        height: 34px;
        min-height: 34px;
    }

    .preview-shell,
    .document-editor-shell,
    .visual-designer-shell,
    .source-editor-shell {
        height: calc(100vh - var(--nav-height) - var(--site-footer-height) - 34px - var(--office-status-height));
        min-height: 80px;
    }
}
