:root {
    --primary: #10B981;
    --primary-dark: #059669;
    --secondary: #6388c2;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --surface-soft: #F9FAFB;
    --surface-hover: #F3F4F6;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-on-primary: #F9FAFB;
    --border: #E5E7EB;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.12);
    --error: #c70909;
    --warning: #e7d429;
    --delete: #c70909c2;

    /* cores dos estágios */
    --stage-montagem: #8B5CF6;
    --stage-testes: #F59E0B;
    --stage-instalacao: #2563EB;
    --stage-concluido: #10B981;
}

html[data-theme="dark"] {
    --primary: #34D399;
    --primary-dark: #10B981;
    --secondary: #93C5FD;
    --bg: #0F172A;
    --surface: #182235;
    --surface-soft: #111827;
    --surface-hover: #243044;
    --text: #E5E7EB;
    --text-secondary: #AAB6C7;
    --text-on-primary: #05140F;
    --border: #334155;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.34);
    --error: #F87171;
    --warning: #FACC15;
    --delete: #EF4444;
}

html[data-theme="midnight"] {
    --primary: #2DD4BF;
    --primary-dark: #14B8A6;
    --secondary: #60A5FA;
    --bg: #020617;
    --surface: #050816;
    --surface-soft: #030712;
    --surface-hover: #111827;
    --text: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-on-primary: #00110F;
    --border: #1E293B;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.46);
    --shadow-md: 0 14px 32px rgba(0, 0, 0, 0.58);
    --error: #FB7185;
    --warning: #FDE047;
    --delete: #F43F5E;
}

html[data-theme="opx-junina"] {
    --primary: #FFC400;
    --primary-dark: #F47B20;
    --secondary: #00E5F0;
    --bg: #020202;
    --surface: #080808;
    --surface-soft: #111111;
    --surface-hover: #1A1712;
    --text: #F8F8F2;
    --text-secondary: #C9C9C3;
    --text-on-primary: #050505;
    --border: #2F2A20;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.52);
    --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.64);
    --error: #FF6B6B;
    --warning: #FFC400;
    --delete: #EF4444;
}

html[data-theme="light"] {
    color-scheme: light;
}

html[data-theme="dark"],
html[data-theme="midnight"],
html[data-theme="opx-junina"] {
    color-scheme: dark;
}

body,
.app-layout,
.main-content,
.content-wrapper,
.top-bar,
.sidebar,
.sidebar-header,
.doc-sections-nav,
.card,
.card-panel,
.resumo-card,
.kpi-card,
.cr-modal,
.data-table th,
.data-table td,
input,
select,
textarea,
button,
a {
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}


/* ================== LAYOUT GERAL ================== */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ================== SIDEBAR PADRÃO ================== */

.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: 0.3s;
}

/* 1. Ajuste no container pai (Header) */
.sidebar-header {
    height: 80px;  /* Aumentei para caber melhor o logo vertical */
    display: flex;
    align-items: center;
    justify-content: center; /* Centraliza tudo horizontalmente */
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    background-color: var(--surface); /* Garante fundo consistente com o tema */
}

/* 2. NOVA CLASSE para o link (substitui a nav-item) */
.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;      /* Ocupa toda a altura do header */
    width: 100%;       /* Ocupa toda a largura disponível */
    text-decoration: none;
}

/* 3. Estilo da imagem para ela crescer */
.brand-logo img {
    max-height: 90%;   /* Usa 90% da altura do header (fica grande mas sem tocar nas bordas) */
    max-width: 100%;   /* Garante que não estoure a largura */
    width: auto;       /* Mantém a proporção */
    object-fit: contain;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--text-on-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.sidebar-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-header-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.nav-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 15px 0 5px 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-group-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--secondary);
    margin-top: 15px;
    margin-bottom: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-item .material-icons-round {
    font-size: 18px;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.nav-item:hover {
    background: var(--surface-hover);
    box-shadow: inset 0 0 0 1px var(--border);
}

.nav-item:hover .material-icons-round {
    color: var(--primary-dark);
}

.nav-item.highlight {
    color: var(--primary-dark);
    background: rgba(21, 224, 55, 0.08);
    box-shadow: inset 0 0 0 1px rgba(21, 224, 55, 0.4);
}

.nav-item.highlight .material-icons-round {
    color: var(--primary-dark);
}

/* ================== MAIN CONTENT / TOP BAR ================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.top-bar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 15px;
}

.menu-btn,
.close-sidebar-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: none;
    color: var(--text-secondary);
}

.menu-btn .material-icons-round,
.close-sidebar-btn .material-icons-round {
    font-size: 22px;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.page-subtitle {
    font-size: 12px;
    margin: 0;
    color: var(--text-secondary);
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* TOPBAR MAIN + AÇÕES (botões à direita) */

.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 12px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================== RESPONSIVO SIDEBAR ================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -100%;
        width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .menu-btn,
    .close-sidebar-btn {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 90;
        display: none;
    }

    .sidebar-overlay.visible {
        display: block;
    }
}

/* ================== FLASH MESSAGES ================== */

.flash-container {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Base de todos os flashes */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid transparent;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

/* Sucesso (verde) */
.flash-success {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: var(--text-on-primary);
}

/* Erro (vermelho) */
.flash-error {
    background: var(--error);
    border-color: #7f0303;
    color: var(--text-on-primary);
}

/* Aviso (amarelo) */
.flash-warning {
    background: rgba(234, 179, 8, 0.12);
    border-color: var(--warning);
    color: #92400e;
}

/* Informação (azul) */
.flash-info {
    background: rgba(37, 99, 235, 0.12);
    border-color: var(--secondary);
    color: #1d4ed8;
}

/* ================== UPLOADER DE FOTOS ================== */

.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* CONTÊINER DAS FOTOS – centralizado */
.photo-grid {
    display: flex;
    gap: 12px;
    justify-content: space-evenly;
    align-content: space-between;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Cada campo de foto */
.photo-field {
    flex: 0 0 auto;
    width: min(10vw, 180px);
}

.field-label {
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-dark);
}

/* Retângulo 16:9 */
.photo-uploader {
    position: relative;
    width: 100%;
    padding-top: 10%;
    border: 1px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

/* conteúdo central (ícone + texto) */
.photo-uploader-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    pointer-events: none;
}

.photo-uploader input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.photo-uploader[data-file-input] input[type="file"] {
    height: 1px;
    inset: auto;
    pointer-events: none;
    width: 1px;
}

.photo-uploader[data-file-click="select"] .photo-uploader-inner {
    pointer-events: auto;
}

.photo-uploader.is-paste-target {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.photo-uploader.is-paste-target .photo-uploader-inner {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.photo-uploader-open {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--secondary);
    cursor: pointer;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    margin: 0;
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 34px;
    z-index: 2;
}

.photo-uploader-open:hover,
.photo-uploader-open:focus-visible {
    border-color: var(--primary);
    color: var(--primary-dark);
    outline: none;
}

.photo-uploader-open .material-icons-round {
    font-size: 18px;
}

/* Estado com arquivo */
.photo-uploader[data-has-file="1"] .photo-uploader-inner {
    background: rgba(0, 0, 0, 0.35);
    color: #f9fafb;
    padding: 4px;
    align-items: center;
    justify-content: flex-end;
}

/* Destaque enquanto arrasta arquivo por cima */
.photo-uploader.is-dragover {
    border-color: var(--primary);
    background-color: rgba(21, 224, 55, 0.06);
    box-shadow: 0 0 0 1px rgba(21, 224, 55, 0.35);
}

/* Título das seções do checklist */
.checklist-section>h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary);
    margin: 24px 0 8px;
}

/* Label acima de cada foto (override suave) */
.field-label {
    font-size: 12px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 4px;
}

.photo-icon {
    font-size: 28px;
}

.photo-helper {
    font-size: 11px;
    margin-top: 4px;
    color: var(--text-secondary);
}

.photo-file-info {
    margin-top: 4px;
    color: #9ca3af;
    font-size: 11px;
}

.photo-file-info .js-file-name.upload-ok {
    color: var(--primary-dark);
    font-weight: 600;
}

.file-uploader {
    display: grid;
    gap: 8px;
    min-width: 0;
    position: relative;
}

.file-uploader input[type="file"] {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

.file-uploader__dropzone {
    align-items: center;
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    gap: 12px;
    min-height: 76px;
    padding: 12px 56px 12px 12px;
    position: relative;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.file-uploader__dropzone:hover,
.file-uploader__dropzone:focus-visible,
.file-uploader.is-paste-target .file-uploader__dropzone,
.file-uploader.is-dragover .file-uploader__dropzone,
.file-uploader__dropzone.is-dragover {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
    outline: none;
}

.file-uploader__open {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    bottom: 10px;
    color: var(--secondary);
    cursor: pointer;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    position: absolute;
    right: 10px;
    width: 38px;
}

.file-uploader__open:hover,
.file-uploader__open:focus-visible {
    border-color: var(--primary);
    color: var(--primary-dark);
    outline: none;
}

.file-uploader__open .material-icons-round {
    font-size: 20px;
}

.file-uploader__icon,
.file-uploader__preview {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--secondary);
    display: inline-flex;
    flex: 0 0 auto;
    height: 48px;
    justify-content: center;
    overflow: hidden;
    width: 48px;
}

.file-uploader__icon {
    font-size: 24px;
}

.file-uploader__preview .material-icons-round {
    font-size: 28px;
}

.file-uploader__preview img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.file-uploader__copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.file-uploader__copy strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.file-uploader__copy span {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.file-uploader__list {
    display: grid;
    gap: 6px;
}

.file-uploader__item {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 34px;
    padding: 7px 9px;
}

.file-uploader__item .material-icons-round {
    color: var(--secondary);
    font-size: 18px;
}

.file-uploader__item-name {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-uploader__item-size {
    color: var(--text-secondary);
    font-size: 11px;
    white-space: nowrap;
}

.file-uploader__error {
    color: var(--error);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

.file-uploader__error[hidden] {
    display: none;
}

.file-uploader--compact .file-uploader__dropzone {
    min-height: 54px;
    padding: 9px 50px 9px 10px;
}

.file-uploader--compact .file-uploader__icon,
.file-uploader--compact .file-uploader__preview {
    height: 36px;
    width: 36px;
}

.file-uploader--compact .file-uploader__open {
    bottom: 9px;
    height: 30px;
    right: 9px;
    width: 34px;
}

.file-uploader--image .file-uploader__dropzone {
    min-height: 92px;
}

/* Margem extra para campos de textarea dentro do checklist */
.field-textarea {
    margin-top: 10px;
}

/* Ajuste opcional para telas muito pequenas */
@media (max-width: 600px) {
    .photo-field {
        width: min(22vw, 160px);
    }
}

/* ================== AUTOCOMPLETE ================== */

.autocomplete-field {
    position: relative;
}

.autocomplete-input {
    width: 100%;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 200px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 0 0 8px 8px;
    border: 1px solid var(--border);
    border-top: none;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    padding: 4px 0;
    display: none;
}

.autocomplete-list.is-visible {
    display: block;
}

.autocomplete-item {
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    background: transparent;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}

.autocomplete-item:hover {
    background: rgba(99, 136, 194, 0.08);
}

/* ================== TABS / PILLS (se usado) ================== */

/* Ações nas tabelas (Abrir / Editar / Excluir numa linha só) */
.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.table-actions form {
    margin: 0;
    /* remove quebra extra do form */
    display: inline;
    /* garante que ele se comporte como item de linha */
}

.btn-delete:hover {
    opacity: 0.62;
}

.btn-sm:hover {
    opacity: 0.62;
}

.tabs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #f9fafb;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tab-pill .material-icons-round {
    font-size: 16px;
}

.tab-pill:hover {
    background: #f3f4f6;
    border-color: var(--secondary);
    color: var(--secondary);
}

.tab-pill.active {
    background: rgba(21, 224, 55, 0.08);
    border-color: var(--primary);
    color: var(--primary-dark);
    box-shadow: 0 0 0 1px rgba(21, 224, 55, 0.25);
}

/* ================== DOCUMENTOS – CONTEÚDO ================== */

.document-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.document-body h1,
.document-body h2,
.document-body h3 {
    margin-top: 1em;
    margin-bottom: 0.4em;
}

.document-body ul,
.document-body ol {
    padding-left: 1.4rem;
    margin: 0.4em 0 0.8em;
}

/* MODO DOCUMENTO: se usar body.doc-mode */
body.doc-mode .sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ================== DOCUMENTOS – HEADER DUPLO ================== */

.doc-header {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

/* Linha 1: menu de seções (Compras, relatorios, etc.) */
.doc-sections-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.doc-sections-nav::-webkit-scrollbar {
    height: 4px;
}

.doc-sections-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

.doc-section-link {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.doc-section-link:hover {
    background: #f3f4f6;
    color: var(--text);
    border-color: var(--border);
}

.doc-section-link.active {
    background: rgba(21, 224, 55, 0.08);
    color: var(--primary-dark);
    border-color: var(--primary);
    font-weight: 600;
}

/* Linha 2: app bar com título + índice */
.doc-topbar {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 16px;
}

.doc-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-title-bar {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
    color: var(--text);
}

.doc-subtitle-bar {
    font-size: 12px;
    margin: 0;
    color: var(--text-secondary);
}

/* NAV com índice dos títulos do documento */
.doc-index-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
}

.doc-index-nav::-webkit-scrollbar {
    height: 4px;
}

.doc-index-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

.doc-index-link {
    border: none;
    background: transparent;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
}

.doc-index-link:hover {
    background: #f3f4f6;
    color: var(--text);
}

.doc-index-link.active {
    background: rgba(21, 224, 55, 0.12);
    color: var(--primary-dark);
    font-weight: 600;
}

/* ================== SIDEBAR ESPECIAL DE DOCUMENTOS ================== */

.sidebar-doc {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-doc .sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-doc-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
}

.sidebar-doc-section {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 8px 4px 4px;
}

.sidebar-doc-link {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-doc-link:hover {
    background: #f3f4f6;
}

.sidebar-doc-link.active {
    background: rgba(21, 224, 55, 0.12);
    color: var(--primary-dark);
    font-weight: 600;
}

/* ================== HEADER DE PÁGINA (título + botão) ================== */

.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.page-header-text h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.page-header-text p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.page-header-actions {
    display: flex;
    align-items: center;
}

/* Botão de "Novo Documento" usando --secondary */
.btn-doc-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    text-decoration: none;

    background: var(--secondary);
    color: var(--text-on-primary);
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
    transition: transform 0.08s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn-doc-secondary .material-icons-round {
    font-size: 18px;
}

.btn-doc-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
    opacity: 0.95;
}

/* ================== DOCUMENTOS / MANUAIS ================== */

.doc-config-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.doc-config-header {
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.doc-config-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

/* corpo genérico do documento (já tinha algo parecido) */
.document-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: transparent;
}

.document-body :where(p, li, td, th, span, div, strong, em, b, i, label, small, font) {
    color: inherit;
}

.document-body :where(h1, h2, h3, h4, h5, h6) {
    color: var(--text);
}

.document-body :where(a) {
    color: var(--secondary);
}

.document-body :where(table) {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.document-body :where(th, td) {
    border-color: var(--border);
    color: var(--text);
}

.document-body :where(code, pre) {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.document-body :where(blockquote) {
    background: var(--surface-soft);
    border-left: 4px solid var(--primary);
    color: var(--text);
    margin-left: 0;
    padding: 10px 12px;
}

.document-body :where(img) {
    max-width: 100%;
}

.document-body [style*="color" i]:not(img):not(svg):not(path) {
    color: var(--text) !important;
}

.document-body [style*="background" i]:not(img):not(svg):not(path) {
    background-color: transparent !important;
    background-image: none !important;
}

.document-body :where(table, thead, tbody, tr, th, td, pre, code, blockquote)[style*="background" i] {
    background-color: var(--surface-soft) !important;
}

.document-body :where(a)[style*="color" i] {
    color: var(--secondary) !important;
}

.doc-config-section {
    margin-top: 20px;
}

.doc-config-section h2 {
    margin: 0;
    font-size: 18px;
    color: var(--primary);
    border-bottom: 2px solid var(--text);
    padding-bottom: 6px;
}

.doc-config-section p,
.doc-config-section ol,
.doc-config-section ul {
    margin-top: 10px;
    line-height: 1.6;
    font-size: 14px;
}

.doc-config-section ul,
.doc-config-section ol {
    padding-left: 20px;
}

.copybox {
    background: var(--text);
    color: var(--surface);
    padding: 10px 12px 8px;
    border-radius: 8px;
    margin: 6px 0 12px;
    position: relative;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    overflow-x: auto;
    font-size: 13px;
}

.copybox pre {
    white-space: pre-wrap;
    margin: 0;
}

.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 11px;
}

.copy-btn:hover {
    background: #f3f4f6;
}

.note {
    background: var(--primary);
    color: #000;
    border-left: 4px solid #000;
    padding: 8px 10px;
    margin: 10px 0;
    font-size: 13px;
}

.doc-config-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-secondary);
}

.doc-config-footer #doc-ano {
    font-weight: 600;
}

@media (max-width: 600px) {
    .doc-config-wrapper {
        padding: 0 4px;
    }

    .doc-config-header h1 {
        font-size: 18px;
    }
}

/* Linha genérica de botões */
.buttons-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Versão: alinhados à direita ocupando a linha toda do grid */
.buttons-row-right {
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.flash-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

/* Base de todos os flashes */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid transparent;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    background: var(--surface);
}

/* Sucesso (verde) */
.flash-success {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: var(--text-on-primary);
}

/* Erro (vermelho) */
.flash-error {
    background: var(--error);
    border-color: #7f0303;
    color: var(--text-on-primary);
}

/* Aviso (amarelo) */
.flash-warning {
    background: rgba(234, 179, 8, 0.95);
    border-color: var(--warning);
    color: #92400e;
}

/* Informação (azul) */
.flash-info {
    background: rgba(37, 99, 235, 0.95);
    border-color: var(--secondary);
    color: #eff6ff;
}

/* ===== MODAL GENÉRICO ===== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    /* overlay escuro */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-backdrop.is-visible {
    display: flex;
}

.modal-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px 22px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.modal-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.modal-text {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Figuras de documentos de configuração */
/* Linha genérica de botões */
.buttons-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
}

/* Versão centralizada na linha */
.buttons-row-center {
    justify-content: center;
}

/* Botão de download importante/perigoso usando --delete */
.btn-download-danger {
    background: var(--delete);
    color: var(--text-on-primary);
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
    transition: transform 0.08s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn-download-danger .material-icons-round {
    font-size: 18px;
}

.btn-download-danger:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}



.doc-figure {
    margin: 16px auto;
    text-align: center;
}

.doc-figure-media {
    display: flex;
    justify-content: center;
}

.doc-figure-img {
    max-height: 40vh;
    /* ~20% da altura da tela/página */
    width: auto;
}

.doc-figure figcaption {
    margin-top: 6px;
    font-size: 0.85rem;
}

.fig-ref {
    font-weight: 600;
    margin-right: 4px;
}

/* ===== MODAL DE CONFIRMAÇÃO – CLÍNICA REMOTA ===== */

:root {
    /* tokens do modal reaproveitando a paleta clínica remota */
    --cr-modal-overlay-bg: rgba(15, 23, 42, 0.55);
    /* fundo escuro com blur */
    --cr-modal-bg: var(--surface);
    /* branco padrão */
    --cr-modal-border: var(--primary-dark);
    /* verde */
    --cr-modal-radius: 16px;
    --cr-modal-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
    --cr-modal-gradient-from: var(--primary-dark);
    /* verde */
    --cr-modal-gradient-to: var(--secondary);
    /* azul */
}

/* Overlay em tela cheia */
.cr-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--cr-modal-overlay-bg);
    backdrop-filter: blur(4px);
}

.cr-modal-overlay[hidden] {
    display: none;
}

/* Card do modal */
.cr-modal {
    width: 100%;
    max-width: 440px;
    background: var(--cr-modal-bg);
    border-radius: var(--cr-modal-radius);
    padding: 1.9rem 2.1rem;
    box-shadow: var(--cr-modal-shadow);
    border: 1px solid rgba(5, 150, 105, 0.35);
    /* verde suave */
    color: var(--text);
    position: relative;
}

/* Linha verde no topo */
.cr-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border-top: 3px solid var(--cr-modal-border);
    opacity: 0.9;
    pointer-events: none;
}

/* Título com gradiente verde → azul */
.cr-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg,
            var(--cr-modal-gradient-from),
            var(--cr-modal-gradient-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.cr-modal-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.cr-modal-icon {
    color: var(--primary-dark);
    font-size: 24px;
}

/* Texto principal */
.cr-modal-message {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Área de botões */
.cr-modal-actions {
    margin-top: 1.6rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.cr-modal-actions button {
    min-width: 96px;
}



/* Cancelar: botão claro com borda azul */
#cr-confirm-modal-cancel {
    color: var(--text);
}

@keyframes cr-modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* grid 2 colunas para cards de gráficos */
.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Cartão de gráfico responsivo */
.cr-chart-card {
    position: relative;
    width: 100%;
    min-height: 260px;
    max-height: 420px;
}

.cr-chart-card .cr-chart {
    position: absolute;
    inset: 0;
}

/* Em telas pequenas aumenta um pouco a altura */
@media (max-width: 768px) {
    .cr-chart-card {
        min-height: 240px;
    }
}

.timeline-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.timeline-block {
    background: var(--card-bg, #fff);
    padding: 16px;
    border-radius: 8px;
}

.timeline-item {
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
}

.timeline-item.done {
    background: #e6ffe6;
    border-left: 4px solid #18a118;
}

.timeline-item.pending {
    background: #fff3cd;
    border-left: 4px solid #d4a300;
}

/* ====== RESUMO DO ATIVO ====== */

.resumo-card {
    background: var(--surface);
    padding: 28px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.resumo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
}

.resumo-item label {
    display: block;
    font-size: 11px;
    letter-spacing: .5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.resumo-item .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

/* Badge de estágio “solta” (se usar em outro lugar) */
.stage-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-on-primary);
    display: inline-block;
}

.stage-montagem {
    background: var(--stage-montagem);
}

.stage-testes {
    background: var(--stage-testes);
}

.stage-instalacao {
    background: var(--stage-instalacao);
}

.stage-concluido {
    background: var(--stage-concluido);
}

/* ====== CONTAINER DO FLUXO / TIMELINE ====== */

.panel-container {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* HEADER VERDE DO ATIVO (card-panel + header-card) */
.card-panel.header-card,
.header-card {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    color: var(--text-on-primary);
    border-radius: 16px;
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
}

.card-panel.header-card h1,
.header-card h1 {
    margin: 0 0 4px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-on-primary);
}

.card-panel.header-card .header-sub,
.header-card .header-sub {
    font-size: 13px;
    color: var(--text-on-primary);
    opacity: 0.95;
}

/* bloco da direita (estágio) */
.ativo-resumo-stage {
    text-align: right;
}

.ativo-resumo-stage-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    color: var(--text-on-primary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-on-primary);
    background: rgba(0, 0, 0, 0.08);
    /* bem clarinho só pra fallback */
    border: 1px solid rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(4px);
}

/* cores por estágio */
.status-badge.stage-montagem {
    background: var(--stage-montagem);
}

.status-badge.stage-testes {
    background: var(--stage-testes);
}
.clickable-row-ready {
  cursor: pointer;
}

.clickable-row-ready:hover {
  filter: brightness(0.98);
}

.sidebar-header img {
    max-height: 100%;  /* Obriga a imagem a usar toda a altura dos 90px */
    width: auto;       /* Mantém a proporção correta (não estica) */
    max-width: 100%;   /* Garante que não estoure a largura */
    object-fit: contain; /* Garante que a imagem fique nítida */
}
.status-badge.stage-instalacao {
    background: var(--stage-instalacao);
}

.status-badge.stage-concluido {
    background: var(--stage-concluido);
}


/* Card branco logo abaixo do cabeçalho (resumo) */
.ativo-resumo-card {
    margin-top: 4px;
}

/* grid da parte de baixo (histórico x galeria) */
.panel-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 18px;
    margin-top: 18px;
}

@media (max-width: 960px) {
    .panel-split {
        grid-template-columns: 1fr;
    }
}

/* grid dos botões de etapas */
.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

/* timeline / histórico */
.timeline-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.timeline-item:last-child {
    border-bottom: none;
}

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-on-primary);
}

.tag.montagem {
    background: var(--stage-montagem);
}

.tag.testes {
    background: var(--stage-testes);
}

.tag.instalacao {
    background: var(--stage-instalacao);
}

.tag.concluido {
    background: var(--stage-concluido);
}

/* galeria */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.photo-item {
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
}

.photo-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.photo-label {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ====== estagios.html ====== */

/* Linha clicável da tabela de estágios */
.clickable-row-ready {
    cursor: pointer;
}

.clickable-row-ready:hover {
    background-color: var(--surface-soft, #f3f4f6);
}


.card-panel-narrow {
    max-width: 840px;
    margin: 0 auto;
}


.table-wrapper-centered {
    display: flex;
    justify-content: center;
}

/* ==== Formulários em formato de lista (configurações) ==== */

.settings-form {
    margin-top: 8px;
}

.settings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle, #e5e7eb);
    background: var(--surface-subtle, #f9fafb);
    overflow: hidden;
}

.settings-item {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: 8px 24px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-label {
    font-weight: 500;
    color: var(--text-muted, #6b7280);
    align-self: center;
    font-size: 0.9rem;
}

.settings-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-control input,
.settings-control select {
    width: 100%;
}

.field-help {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
}

/* Ações do formulário (botões alinhados à direita) */
.form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}


.table-centered th,
.table-centered td {
    text-align: center;
}


.card-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.inline-form {
    display: inline;
}


/* ====== Página de esquemas dos estágios ====== */

.estagios-esquemas-page .card-panel {
    border-radius: 12px;
}

/* Nova seção: título + ordem + botão na mesma linha */
.estagios-esquemas-page .new-section-form {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) auto;
    gap: 10px 16px;
    align-items: flex-end;
}

/* Linha de edição da seção (form + botão excluir) */
.estagios-esquemas-page .section-edit-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}

/* Form principal da seção (título + ordem + salvar) */
.estagios-esquemas-page .section-edit-main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) auto;
    gap: 10px 16px;
    align-items: flex-end;
}

/* Form do botão de excluir seção */
.estagios-esquemas-page .section-delete-form {
    flex: 0 0 auto;
}

/* Form dos itens: slug, label, tipo, ordem + ações tudo na mesma linha */
.estagios-esquemas-page .item-form {
    display: grid;
    grid-template-columns:
        minmax(0, 1.1fr)   /* slug  */
        minmax(0, 2fr)     /* label */
        minmax(0, 1.1fr)   /* tipo  */
        minmax(0, 0.8fr)   /* ordem */
        auto;              /* ações */
    gap: 10px 12px;
    align-items: flex-end;
}

.estagios-esquemas-page .item-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

/* Campos com largura total dentro dos grids */
.estagios-esquemas-page .item-form .field input,
.estagios-esquemas-page .item-form .field select,
.estagios-esquemas-page .new-section-form .field input,
.estagios-esquemas-page .section-edit-main .field input {
    width: 100%;
}

/* Labels compactas */
.estagios-esquemas-page .field label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Responsivo: quebra para colunas únicas em telas menores */
@media (max-width: 960px) {
    .estagios-esquemas-page .new-section-form,
    .estagios-esquemas-page .section-edit-main,
    .estagios-esquemas-page .item-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .estagios-esquemas-page .section-edit-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ====== ITENS DO CHECKLIST (estagios_esquemas) ====== */

.estagios-table-items th,
.estagios-table-items td {
    padding: 6px 8px;
}

.estagios-table-items td {
    vertical-align: middle;
}

.estagios-table-items input,
.estagios-table-items select {
    font-size: 13px;
    padding: 6px 8px;
    box-sizing: border-box;
}

.estagios-table-items .item-actions-cell {
    text-align: right;
}

.estagios-table-items .item-actions-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.estagios-esquemas-page .unsaved-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--text);
    font-size: 13px;
}

.estagios-esquemas-page .unsaved-banner > span:nth-child(2) {
    flex: 1;
}

.estagios-esquemas-page .unsaved-banner-actions,
.estagios-esquemas-page .estagios-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.estagios-esquemas-page [data-save-all]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.estagios-esquemas-page .unsaved-banner .material-icons-round {
    color: var(--warning);
    font-size: 20px;
}

.estagios-table-items tr.is-unsaved {
    box-shadow: inset 3px 0 0 var(--warning);
}

.estagios-table-items tr.is-unsaved input,
.estagios-table-items tr.is-unsaved select {
    border-color: rgba(245, 158, 11, 0.75);
}

.estagios-table-items .unsaved-badge {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.16);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* ====== Estágios – Esquemas (seções) ====== */

.estagios-esquemas-page .new-section-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.estagios-esquemas-page .new-section-form .field {
    flex: 1;
    margin-bottom: 0;
}

.estagios-esquemas-page .new-section-form .field.small {
    flex: 0 0 120px;
}

.estagios-esquemas-page .new-section-form .btn-sm {
    white-space: nowrap;
}

/* linha de edição da seção (salvar + excluir na mesma linha) */
.estagios-esquemas-page .section-edit-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.estagios-esquemas-page .section-edit-main {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.estagios-esquemas-page .section-edit-main .field {
    flex: 1;
    margin-bottom: 0;
}

.estagios-esquemas-page .section-edit-main .field.small {
    flex: 0 0 120px;
}

.estagios-esquemas-page .section-edit-main .btn-sm {
    white-space: nowrap;
}

.estagios-esquemas-page .section-delete-form {
    margin: 0;
}

.estagios-esquemas-page .section-delete-form .btn-sm {
    white-space: nowrap;
}
.data-table thead th.ordem-asc::after {
  content: " ▲";
  opacity: 0.7;
  font-size: 0.9em;
}

.data-table thead th.ordem-desc::after {
  content: " ▼";
  opacity: 0.7;
  font-size: 0.9em;
}
.clickable-row-ready { cursor: pointer; }
.data-table tbody tr.clickable-row-ready:hover { filter: brightness(1.03); }
:root {
    --sidebar-width: 280px;
    --topbar-height: 64px;
    --sidebar-transition-duration: 750ms;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

.app-layout {
    min-height: 100vh;
}

/* sem animação no carregamento / refresh / navegação */
.app-layout.no-anim .sidebar,
.app-layout.no-anim .main-content,
.app-layout.no-anim .sidebar-overlay {
    transition: none !important;
}

/* animação só quando o JS libera */
.app-layout:not(.no-anim) .sidebar,
.app-layout:not(.no-anim) .main-content,
.app-layout:not(.no-anim) .sidebar-overlay {
    transition:
        transform var(--sidebar-transition-duration) ease,
        margin-left var(--sidebar-transition-duration) ease,
        width var(--sidebar-transition-duration) ease,
        max-width var(--sidebar-transition-duration) ease,
        opacity var(--sidebar-transition-duration) ease,
        visibility var(--sidebar-transition-duration) ease;
}

.top-bar {
    display: grid;
    grid-template-columns: 42px 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: var(--topbar-height);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-main {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.menu-btn,
.doc-back-btn,
.close-sidebar-btn,
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
}

.theme-toggle-btn:hover,
.doc-back-btn:hover,
.menu-btn:hover,
.close-sidebar-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.theme-selector {
    display: inline-flex;
    position: relative;
}

.theme-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    display: grid;
    gap: 4px;
    min-width: 210px;
    opacity: 0;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    visibility: hidden;
    z-index: 30;
}

.theme-selector.is-open .theme-menu {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.theme-option {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    gap: 8px;
    padding: 9px 10px;
    text-align: left;
    width: 100%;
}

.theme-option:hover,
.theme-option:focus-visible,
.theme-option.is-active {
    background: var(--surface-hover);
    outline: none;
}

.theme-option.is-active {
    color: var(--primary-dark);
    font-weight: 700;
}

.theme-option .material-icons-round {
    color: var(--text-secondary);
    font-size: 18px;
}

.theme-option.is-active .material-icons-round {
    color: var(--primary-dark);
}

.topbar-actions {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.global-user-search {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: inline-flex;
    gap: 6px;
    min-width: 260px;
    padding: 0 10px;
    position: relative;
}

.global-user-search .material-icons-round {
    color: var(--text-secondary);
    font-size: 18px;
}

.global-user-search input {
    background: transparent;
    border: 0;
    color: var(--text);
    height: 36px;
    min-width: 0;
    outline: none;
    width: 100%;
}

.global-user-search-results {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    display: none;
    left: auto;
    min-width: 360px;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(46vw, 520px);
    z-index: 60;
}

.global-user-search.is-open .global-user-search-results {
    display: grid;
}

.global-user-search-result {
    align-items: center;
    color: var(--text);
    display: grid;
    gap: 8px;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 9px 10px;
    text-decoration: none;
}

.global-user-search-result:hover,
.global-user-search-result:focus-visible {
    background: var(--surface-hover);
    outline: none;
}

.global-user-search-result-avatar {
    align-items: center;
    background: var(--primary);
    border-radius: 999px;
    color: var(--text-on-primary);
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.global-search-result-icon {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary) !important;
    display: inline-flex;
    font-size: 19px !important;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.global-user-search-result-copy {
    min-width: 0;
}

.global-user-search-result-copy strong,
.global-user-search-result-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-user-search-result-copy small {
    color: var(--text-secondary);
}

.global-user-search-empty {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 12px;
}

.notification-button {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    position: relative;
    text-decoration: none;
    width: 38px;
}

.notification-button:hover,
.notification-button:focus-visible {
    border-color: var(--primary);
    color: var(--primary-dark);
    outline: none;
}

.notification-badge {
    align-items: center;
    background: var(--primary);
    border: 1px solid var(--surface);
    border-radius: 999px;
    color: var(--text-on-primary);
    display: inline-flex;
    font-size: 10px;
    font-weight: 700;
    height: 18px;
    justify-content: center;
    min-width: 18px;
    padding: 0 4px;
    position: absolute;
    right: -5px;
    top: -5px;
}

.chat-call-toast {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 8px;
    bottom: 18px;
    box-shadow: var(--shadow-md);
    display: grid;
    gap: 10px;
    max-width: 320px;
    padding: 14px;
    position: fixed;
    right: 18px;
    z-index: 80;
}

.chat-call-toast p {
    margin: 0;
}

.chat-call-toast-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 1023px) {
    .global-user-search {
        min-width: 190px;
    }
}

@media (max-width: 720px) {
    .topbar-actions {
        gap: 6px;
    }

    .global-user-search {
        min-width: 150px;
        width: min(42vw, 190px);
    }
}

@media (max-width: 520px) {
    .global-user-search {
        min-width: 42px;
        padding: 0 10px;
        width: 42px;
    }

    .global-user-search input {
        opacity: 0;
        width: 0;
    }

    .global-user-search:focus-within,
    .global-user-search.is-open {
        min-width: 170px;
        width: min(68vw, 240px);
    }

    .global-user-search:focus-within input,
    .global-user-search.is-open input {
        opacity: 1;
        width: 100%;
    }

    .global-user-search-results {
        left: 0;
        min-width: 220px;
        right: auto;
        width: min(72vw, 260px);
    }

    .chat-call-toast {
        bottom: 12px;
        left: 12px;
        max-width: none;
        right: 12px;
    }
}

.coming-soon-card {
    align-items: center;
    display: grid;
    gap: 10px;
    justify-items: center;
    min-height: 280px;
    text-align: center;
}

.coming-soon-card .material-icons-round {
    color: var(--primary);
    font-size: 42px;
}

.coming-soon-card h2 {
    margin: 0;
}

.topbar-user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar-user-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.user-menu-toggle {
    width: 42px;
    height: 42px;
    border: 0;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-avatar,
.profile-avatar-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    color: var(--text-on-primary);
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.user-avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
    overflow: hidden;
}

.user-avatar img,
.profile-avatar-lg img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

.user-menu-toggle:hover .user-avatar,
.topbar-user-menu.is-open .user-avatar {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.3),
        0 0 0 3px rgba(16, 185, 129, 0.18);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease;
}

.topbar-user-menu.is-open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.user-dropdown-header small {
    color: var(--text-secondary);
    font-size: 12px;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
}

.user-dropdown a:hover {
    background: var(--surface-hover);
}

.user-dropdown .material-icons-round {
    font-size: 18px;
    color: var(--text-secondary);
}

.mobile-sidebar-fab {
    display: none;
}

@media (min-width: 1024px) {
    .top-bar .menu-btn {
        display: none;
    }

    .top-bar {
        grid-template-columns: 42px minmax(0, 1fr) auto;
    }
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 86vw;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    z-index: 1100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--topbar-height);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.brand-logo img {
    display: block;
    max-height: 42px;
    width: auto;
}

#appSidebar > .sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    flex: 0 0 var(--topbar-height);
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
}

#appSidebar > .sidebar-brand-row .brand-logo {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 50px);
    overflow: hidden;
}

#appSidebar > .sidebar-brand-row .brand-logo img {
    max-height: 48px;
    max-width: 100%;
    min-width: 0;
    flex: 0 1 auto;
    object-fit: contain;
    object-position: center;
}

#appSidebar .sidebar-minimize-btn {
    flex: 0 0 42px;
}

.app-layout:not(.no-anim) #appSidebar > .sidebar-brand-row,
.app-layout:not(.no-anim) #appSidebar > .sidebar-brand-row .brand-logo,
.app-layout:not(.no-anim) #appSidebar > .sidebar-brand-row .brand-logo img,
.app-layout:not(.no-anim) #appSidebar .sidebar-minimize-btn {
    transition:
        max-width var(--sidebar-transition-duration) ease,
        max-height var(--sidebar-transition-duration) ease,
        padding var(--sidebar-transition-duration) ease,
        opacity var(--sidebar-transition-duration) ease,
        width var(--sidebar-transition-duration) ease,
        flex-basis var(--sidebar-transition-duration) ease;
}

.brand-text {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 14px 0 28px;
}

.nav-label,
.sidebar-doc-section {
    padding: 14px 20px 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.nav-item,
.sidebar-doc-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.sidebar-doc-link.active {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.main-content {
    min-width: 0;
    width: 100%;
}

.content-wrapper {
    padding: 20px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1090;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.doc-sections-nav {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    overflow-x: auto;
}

/* desktop: já nasce aberto via .sidebar-open no HTML */
@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .app-layout.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-layout.sidebar-open .main-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    .app-layout:not(.sidebar-open) .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* mobile */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

/* ====== Ajustes da gestao: sidebar recolhida, logo central e voltar a esquerda ====== */
:root {
    --sidebar-collapsed-width: 72px;
}

.top-bar {
    grid-template-columns: 42px 42px minmax(0, 1fr) auto;
    position: sticky;
}

.topbar-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    max-width: 160px;
    text-decoration: none;
}

.topbar-logo img {
    display: block;
    max-height: 46px;
    max-width: 150px;
    width: auto;
    object-fit: contain;
}

#appSidebar .sidebar-header {
    justify-content: space-between;
}

#appSidebar .sidebar-header .brand-logo {
    display: none;
}

#appSidebar .sidebar-header-title {
    white-space: nowrap;
}

.app-layout:not(.no-anim) #appSidebar .sidebar-header-title,
.app-layout:not(.no-anim) #appSidebar .nav-label,
.app-layout:not(.no-anim) #appSidebar .nav-item span:not(.material-icons-round) {
    transition:
        opacity var(--sidebar-transition-duration) ease,
        max-width var(--sidebar-transition-duration) ease,
        max-height var(--sidebar-transition-duration) ease,
        width var(--sidebar-transition-duration) ease,
        height var(--sidebar-transition-duration) ease,
        padding var(--sidebar-transition-duration) ease,
        margin var(--sidebar-transition-duration) ease;
}

#appSidebar .sidebar-header-title,
#appSidebar .nav-label,
#appSidebar .nav-item span:not(.material-icons-round) {
    max-width: 220px;
    max-height: 48px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
        width: var(--sidebar-collapsed-width);
        max-width: var(--sidebar-collapsed-width);
        overflow-x: hidden;
    }

    .app-layout.sidebar-open .sidebar {
        width: var(--sidebar-width);
        max-width: var(--sidebar-width);
    }

    .app-layout.sidebar-open .main-content {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    .app-layout:not(.sidebar-open) .main-content {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }

    .app-layout:not(.sidebar-open) #appSidebar > .sidebar-brand-row {
        gap: 2px;
        padding-inline: 4px;
    }

    .app-layout:not(.sidebar-open) #appSidebar > .sidebar-brand-row .brand-logo {
        max-width: calc(var(--sidebar-collapsed-width) - 34px);
    }

    .app-layout:not(.sidebar-open) #appSidebar > .sidebar-brand-row .brand-logo img {
        max-height: 42px;
        max-width: 100%;
    }

    .app-layout:not(.sidebar-open) #appSidebar .sidebar-minimize-btn {
        width: 28px;
        height: 40px;
        flex-basis: 28px;
        border-radius: 8px;
    }

    .app-layout:not(.sidebar-open) #appSidebar .sidebar-minimize-btn .material-icons-round {
        font-size: 22px;
    }

    .app-layout:not(.sidebar-open) #appSidebar .sidebar-header-title,
    .app-layout:not(.sidebar-open) #appSidebar .nav-label,
    .app-layout:not(.sidebar-open) #appSidebar .nav-item span:not(.material-icons-round) {
        opacity: 0;
        width: 0;
        height: 0;
        max-width: 0;
        max-height: 0;
        overflow: hidden;
        pointer-events: none;
    }

    .app-layout:not(.sidebar-open) #appSidebar .nav-label {
        margin-block: 0;
        padding-block: 0;
    }

    .app-layout:not(.sidebar-open) #appSidebar .sidebar-header {
        justify-content: center;
        padding: 0;
    }

    .app-layout:not(.sidebar-open) #appSidebar .sidebar-nav {
        padding: 14px 0 28px;
    }

    .app-layout:not(.sidebar-open) #appSidebar .nav-item {
        justify-content: center;
        gap: 0;
        padding: 12px 0;
    }

    .app-layout:not(.sidebar-open) #appSidebar .nav-item .material-icons-round {
        font-size: 24px;
    }
}

@media (max-width: 720px) {
    .topbar-logo {
        display: none;
    }

    .top-bar {
        grid-template-columns: 42px 42px minmax(0, 1fr) auto;
    }

    .topbar-user-name {
        display: none;
    }
}

.profile-page {
    max-width: 900px;
    margin: 0 auto;
}

.profile-card {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 28px;
    flex: 0 0 auto;
    overflow: hidden;
}

.profile-card-header h2 {
    margin: 0;
    color: var(--text);
}

.profile-card-header p {
    margin: 4px 0 0;
    color: var(--text-secondary);
}

.profile-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.profile-info-grid div {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.profile-info-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.profile-info-grid strong {
    color: var(--text);
    font-size: 14px;
}

/* ====== Sidebar responsiva/mobile ====== */
@media (max-width: 1023px) {
    .app-layout {
        display: block;
        min-height: 100vh;
        height: auto;
        overflow: visible;
    }

    .sidebar,
    #appSidebar,
    #docSidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(86vw, 320px);
        max-width: min(86vw, 320px);
        height: 100dvh;
        transform: translateX(-100%);
        overflow-x: hidden;
        overflow-y: auto;
        z-index: 1100;
    }

    .sidebar.open,
    #appSidebar.open,
    #docSidebar.open {
        transform: translateX(0);
    }

    .main-content,
    .app-layout.sidebar-open .main-content,
    .app-layout:not(.sidebar-open) .main-content {
        width: 100%;
        margin-left: 0;
    }

    .sidebar-overlay {
        display: block;
        z-index: 1090;
    }

    .menu-btn,
    .close-sidebar-btn {
        display: inline-flex !important;
    }

    .top-bar .menu-btn {
        grid-column: 2;
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        min-width: 42px;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        position: relative;
        z-index: 3;
    }

    #appSidebar .sidebar-header,
    #docSidebar .sidebar-header {
        justify-content: space-between;
        padding: 0 16px;
    }

    #appSidebar .sidebar-header-title,
    #appSidebar .nav-label,
    #appSidebar .nav-item span:not(.material-icons-round) {
        opacity: 1;
        width: auto;
        height: auto;
        overflow: visible;
        pointer-events: auto;
    }

    #appSidebar .sidebar-nav {
        padding: 14px 0 28px;
    }

    #appSidebar .nav-item {
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 20px;
    }

    #appSidebar .nav-item .material-icons-round {
        font-size: 22px;
    }

    .top-bar {
        grid-template-columns: 42px 42px minmax(0, 1fr) auto;
    }

    .mobile-sidebar-fab {
        position: fixed;
        left: 14px;
        bottom: 14px;
        z-index: 1080;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--surface);
        color: var(--text);
        box-shadow: var(--shadow-md);
        cursor: pointer;
    }

    .mobile-sidebar-fab .material-icons-round {
        font-size: 24px;
    }
}

@media (max-width: 520px) {
    .top-bar {
        gap: 8px;
        padding: 0 10px;
    }

    .page-title,
    .doc-title-bar {
        font-size: 15px;
    }

    .page-actions {
        display: none;
    }
}
