/* ==========================================================================
   OFFICE STUDIO AI STYLES (TẠO, SỬA & ĐÁNH GIÁ OFFICE LOCAL OLLAMA)
   ========================================================================== */
.office-studio-container {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    box-sizing: border-box;
    min-height: 100%;
}

.office-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.office-title-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.office-main-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.office-title-row h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    color: var(--text-primary);
}

.office-title-row p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.office-subnav-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.office-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.office-pill-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--primary-light, #818cf8);
}

.office-pill-btn.active {
    background: var(--primary, #4f46e5);
    color: #ffffff;
    border-color: var(--primary, #4f46e5);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}

.office-subpanel {
    animation: fadeIn 0.25s ease-out;
}

.office-grid-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 1.5rem;
    min-width: 0;
    width: 100%;
    align-items: start;
}

.office-form-card,
.office-result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.office-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Định dạng selector thẻ (docx, xlsx, pptx) */
.office-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.office-type-card {
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-surface-elevated);
}

.office-type-card:hover {
    border-color: var(--primary-light, #818cf8);
    transform: translateY(-1px);
}

.office-type-card.active {
    border-color: var(--primary, #4f46e5);
    background: rgba(79, 70, 229, 0.06);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.type-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.type-text strong {
    display: block;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.type-text span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.office-prompt-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.office-textarea {
    width: 100%;
    border-radius: 10px;
    padding: 0.85rem;
    font-size: 0.92rem;
    line-height: 1.5;
    resize: vertical;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    box-sizing: border-box;
}

.office-textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.office-quick-prompts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.quick-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.office-chip {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.office-chip:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.office-params-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.25rem 0;
}

.office-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
}

.office-btn-large {
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Dropzones */
.office-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.2rem 1.5rem;
    text-align: center;
    background: var(--bg-surface-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
}

.office-dropzone:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.03);
}

.drop-icon {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.dropzone-inner h4 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
}

.drop-hint {
    margin: 0;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.selected-file-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 20px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

.file-chip-remove {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 2px;
}

/* Result Card & Placeholder */
.office-result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 1.5rem;
    border: 1.5px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.65;
}

.office-result-placeholder h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.office-result-placeholder p {
    margin: 0;
    font-size: 0.82rem;
    max-width: 360px;
}

.office-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
}

.office-loading-box h4 {
    margin: 1rem 0 0.25rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.office-loading-box p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Success Card */
.success-file-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1.5px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.15rem;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.success-file-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-width: 0;
}

.file-icon-badge {
    width: 44px;
    height: 44px;
    font-size: 1.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 10px;
    flex-shrink: 0;
    line-height: 1;
}

.file-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.file-details h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.file-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.file-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #10b981;
    font-weight: 600;
}

.file-status-tag::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.office-success-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.office-preview-action,
.office-download-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.office-preview-action {
    background: var(--primary, #4f46e5);
    color: #ffffff !important;
    border: 1px solid var(--primary, #4f46e5);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.office-preview-action:hover {
    background: var(--primary-hover, #4338ca);
    transform: translateY(-1px);
}

.office-download-action {
    background: #10b981;
    color: #ffffff !important;
    border: 1px solid #10b981;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.office-download-action:hover {
    background: #059669;
    transform: translateY(-1px);
}

.office-preview-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-surface-elevated);
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.preview-header-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary, #4f46e5);
    font-weight: 600;
}

.office-preview-body {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: auto;
    padding: 1rem 1.15rem;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text-secondary);
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.office-preview-body * {
    max-width: 100%;
    box-sizing: border-box;
}

.office-preview-body h1,
.office-preview-body h2,
.office-preview-body h3,
.office-preview-body h4 {
    color: var(--text-primary);
    margin-top: 0.85rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.office-preview-body h1 { font-size: 1.15rem; }
.office-preview-body h2 { font-size: 1.05rem; }
.office-preview-body h3 { font-size: 0.95rem; }
.office-preview-body h4 { font-size: 0.88rem; }

.office-preview-body p {
    margin: 0 0 0.65rem 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.office-preview-body ul,
.office-preview-body ol {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
}

.office-preview-body li {
    margin-bottom: 0.35rem;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.office-preview-body table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 0.75rem 0;
    table-layout: auto;
}

.office-preview-body th,
.office-preview-body td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.office-preview-body th {
    background: rgba(79, 70, 229, 0.08);
    color: var(--text-primary);
    font-weight: 600;
}

.office-preview-body pre,
.office-preview-body code {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-family: var(--font-mono, monospace);
    font-size: 0.82rem;
}

/* Changelog card */
.office-changelog-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

.office-changelog-card h4 {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.changelog-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Sub-panel 3: Đánh giá & Chấm điểm (Evaluator) */
.office-eval-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.office-eval-header-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.eval-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.eval-drop-box h4 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.office-dropzone-sm {
    border: 1.5px dashed var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    background: var(--bg-surface-elevated);
    cursor: pointer;
    transition: all 0.2s ease;
}

.office-dropzone-sm:hover {
    border-color: var(--primary);
}

.dropzone-inner-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.drop-icon-sm {
    font-size: 1.35rem;
}

.drop-label-sm {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.selected-file-badge-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-radius: 14px;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.eval-controls-bar {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr auto;
    gap: 0.85rem;
    align-items: center;
}

.eval-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Evaluation Score Hero */
.eval-score-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(30, 58, 138, 0.2);
}

.eval-score-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 3px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#eval-score-num {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    color: #ffffff;
}

.eval-score-max {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.eval-score-meta {
    flex: 1;
}

.eval-badge-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.eval-grade-badge {
    background: #10b981;
    color: #ffffff;
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

.eval-percent-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
}

#eval-title-display {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.eval-summary-text {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.9);
}

/* Section Cards for Evaluation */
.eval-section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-top: 1.25rem;
}

.eval-sec-title {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0 0 0.85rem;
    color: var(--text-primary);
}

.eval-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.eval-column-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
}

.eval-bullet-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.eval-bullet-list li {
    margin-bottom: 0.4rem;
}

/* Bảng Office Evaluation */
.table-office-eval,
.table-office-files {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-office-eval th,
.table-office-files th {
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table-office-eval td,
.table-office-files td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.table-office-eval tbody tr:hover,
.table-office-files tbody tr:hover {
    background: var(--bg-surface-elevated);
}

.status-badge-pass {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.status-badge-partial {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.status-badge-fail {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* Mobile responsive */
@media (max-width: 992px) {
    .office-grid-layout,
    .eval-grid-two,
    .eval-two-columns {
        grid-template-columns: 1fr;
    }
    .eval-controls-bar {
        grid-template-columns: 1fr;
    }
    .office-type-selector {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .eval-score-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .eval-download-action-wrap {
        width: 100%;
    }
    .eval-download-action-wrap .btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .office-success-actions {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   OFFICE STUDIO: SMART CONFIG DECK (MÔ HÌNH AI & PHONG CÁCH VĂN BẢN ĐỒNG BỘ)
   ========================================================================== */
.office-settings-deck {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.15rem;
    margin-top: 1.15rem;
    margin-bottom: 1.25rem;
    padding: 1.15rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.office-setting-col {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.office-setting-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.office-model-pill-grid,
.office-style-pill-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.office-model-pill,
.office-style-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.62rem 0.85rem;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.office-model-pill:hover,
.office-style-pill:hover {
    border-color: var(--primary-light, #818cf8);
    background: var(--bg-surface-elevated);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.office-model-pill.active,
.office-style-pill.active {
    border-color: var(--primary, #4f46e5);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.02) 100%);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.18), 0 3px 10px rgba(79, 70, 229, 0.08);
}

.pill-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-elevated);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pill-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pill-title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.pill-title-row strong {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 700;
}

.pill-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pill-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.badge-rec { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-cot { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-pro { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.badge-code { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.badge-gov { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-corp { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-acad { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-modern { background: rgba(20, 184, 166, 0.15); color: #14b8a6; }

.pill-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.office-model-pill.active .pill-check,
.office-style-pill.active .pill-check {
    background: var(--primary, #4f46e5);
    border-color: var(--primary, #4f46e5);
    color: #ffffff;
}

@media (max-width: 900px) {
    .office-settings-deck {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.95rem;
    }
}

/* ==========================================================================
   OFFICE ONLINE PREVIEW STUDIO MODAL (CHUYÊN NGHIỆP & HIỆN ĐẠI)
   ========================================================================== */
.office-preview-modal-card {
    max-width: 1200px;
    width: 96%;
    height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    background: var(--bg-surface);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
}

.office-preview-modal-card.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    border: none !important;
}

.office-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.preview-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.preview-doc-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.preview-filename {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.preview-sub-status {
    font-size: 0.73rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1px;
}

.status-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    display: inline-block;
}

.preview-tools-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.preview-zoom-group {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px 4px;
    gap: 3px;
}

.zoom-level-text {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0 6px;
    min-width: 42px;
    text-align: center;
    color: var(--text-secondary);
}

.office-preview-canvas {
    flex: 1;
    overflow: auto;
    background: #475569;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

[data-theme="light"] .office-preview-canvas {
    background: #e2e8f0;
}

.office-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ffffff;
    gap: 0.75rem;
}

/* DOCX Preview Page Wrapper (A4 Simulation) */
.office-docx-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.office-docx-container .docx-wrapper {
    background: transparent !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.office-docx-container .docx {
    background: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22) !important;
    border-radius: 4px !important;
    padding: 72pt 72pt !important;
    min-height: 842pt;
    width: 595pt;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto !important;
}

/* Fallback visual document render (In case third-party library encounters odd binary) */
.office-preview-fallback-doc {
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
    border-radius: 4px;
    padding: 60pt 60pt;
    min-height: 842pt;
    width: 595pt;
    max-width: 100%;
    box-sizing: border-box;
    font-family: "Times New Roman", Times, serif;
    line-height: 1.6;
}

.fallback-doc-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1.5rem;
}

.fallback-doc-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #1e3a8a;
    text-transform: uppercase;
}

.fallback-doc-header p {
    font-size: 0.95rem;
    font-style: italic;
    color: #64748b;
    margin: 0;
}

.fallback-doc-section {
    margin-bottom: 1.5rem;
}

.fallback-doc-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0 0 0.5rem 0;
}

/* XLSX Preview Container */
.office-xlsx-wrapper {
    width: 100%;
    max-width: 1050px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.office-xlsx-ribbon-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: #107c41;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
}

.office-xlsx-container {
    width: 100%;
    overflow: auto;
    max-height: 65vh;
    padding: 1rem;
    box-sizing: border-box;
}

.office-xlsx-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: #1f2937;
    font-family: Calibri, Segoe UI, sans-serif;
}

.office-xlsx-container th,
.office-xlsx-container td {
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    text-align: left;
}

.office-xlsx-container th {
    background: #107c41;
    color: #ffffff;
    font-weight: 700;
    text-align: center;
}

.office-xlsx-container tr:nth-child(even) td {
    background: #f8fafc;
}

.office-xlsx-sheet-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    overflow-x: auto;
}

.xlsx-sheet-tab-btn {
    padding: 5px 14px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.xlsx-sheet-tab-btn.active {
    background: #107c41;
    color: #ffffff;
    border-color: #107c41;
}

/* PPTX Slide Studio Layout */
.office-pptx-container {
    width: 100%;
    max-width: 1080px;
    height: 72vh;
    display: flex;
    gap: 1rem;
}

.pptx-thumb-rail {
    width: 190px;
    flex-shrink: 0;
    background: var(--bg-surface-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow-y: auto;
}

.pptx-thumb-item {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}

.pptx-thumb-item:hover {
    border-color: var(--primary-light, #818cf8);
}

.pptx-thumb-item.active {
    border-color: var(--primary, #4f46e5);
    background: rgba(79, 70, 229, 0.08);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.thumb-num {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary);
}

.thumb-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pptx-main-deck {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    height: 100%;
}

.pptx-slide-canvas {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
    overflow-y: auto;
    padding: 2.2rem 2.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.office-pptx-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.65rem 1.25rem;
    background: var(--bg-surface-elevated);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.office-pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
    border-radius: 8px;
}

/* Print CSS */
@media print {
    body * {
        visibility: hidden !important;
    }
    #office-preview-modal,
    #office-preview-modal .office-preview-canvas,
    #office-preview-modal .office-docx-container,
    #office-preview-modal .office-docx-container * {
        visibility: visible !important;
    }
    #office-preview-modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: transparent !important;
        display: block !important;
        padding: 0 !important;
    }
    .office-preview-toolbar,
    .preview-tools-actions {
        display: none !important;
    }
    .office-preview-canvas {
        background: transparent !important;
        padding: 0 !important;
    }
}





