/* Carpintaria Reis | tema claro compartilhado pelas telas do sistema. */
:root {
    --reis-canvas: #f7f6f2;
    --reis-nav: #efeee7;
    --reis-surface: #ffffff;
    --reis-soft: #f4f5ef;
    --reis-border: #e0e2d8;
    --reis-ink: #25362e;
    --reis-muted: #66715f;
    --reis-primary: #294d40;
    --reis-primary-hover: #203e33;
    --reis-tint: #eaf0e9;
    --reis-gold: #d6bb87;
    --reis-radius: 12px;
    --bs-body-color: var(--reis-ink);
    --bs-body-bg: var(--reis-canvas);
    --bs-primary: var(--reis-primary);
    --bs-primary-rgb: 41, 77, 64;
    --bs-border-color: var(--reis-border);
    --bs-link-color: var(--reis-primary);
    --bs-link-hover-color: var(--reis-primary-hover);
    --bs-focus-ring-color: #294d4020;
}
body {
    background: var(--reis-canvas) !important;
    color: var(--reis-ink);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
::selection { color: #203e33; background: #dce8da; }
input, select, textarea { accent-color: var(--reis-primary); }
input::placeholder, textarea::placeholder { color: #8d9688; opacity: 1; }

/* Menu claro, com os mesmos destinos e o mesmo modo compacto. */
.sidebar.sidebar-compact {
    background: var(--reis-nav);
    color: var(--reis-ink);
    border-right: 1px solid var(--reis-border);
    box-shadow: none;
    scrollbar-color: #c3c8b9 transparent;
    padding-top: 20px;
}
.sidebar.sidebar-compact:is(:hover, :focus-within) { box-shadow: 7px 0 22px #263b2d09; }
.sidebar-compact .sidebar-brand { min-height: 88px; align-items: center; border-color: #dce0d2; margin-bottom: 20px; padding-bottom: 20px; }
.sidebar-compact .sidebar-brand-logo { width: 44px; height: 66px; flex: 0 0 44px; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.sidebar-brand-logo .sidebar-logo-monogram { top: 2px; }
.sidebar-brand-logo .sidebar-logo-full { display: none; position: static; width: 100%; height: 100%; max-width: 100%; object-fit: contain; }
.sidebar-compact .sidebar-brand-text strong, .sidebar-compact .sidebar-brand-text > span {
    font-family: inherit; font-size: 10px; line-height: 1.8; font-weight: 650;
    letter-spacing: 1.25px; text-transform: uppercase; color: var(--reis-ink); margin: 0;
}
.sidebar-brand-subtitle { display: block; color: var(--reis-muted); font-size: 10px; line-height: 1.5; margin-top: 5px; font-weight: 400; white-space: normal; }
.sidebar-compact .sidebar-menu { gap: 4px; }
.sidebar-compact .menu-title { color: #78836f; font-size: 9px; letter-spacing: 1.5px; font-weight: 500; }
.sidebar-compact .menu-group-title { margin-top: 19px; margin-bottom: 9px; }
.sidebar-compact .menu-item { color: #566454; border-radius: 8px; min-height: 45px; font-size: 12px; font-weight: 450; }
.sidebar-compact .menu-item:hover { color: var(--reis-primary); background: #e3e7db; transform: none; }
.sidebar-compact .menu-item.active { background: var(--reis-primary); color: #fff; font-weight: 600; }
.sidebar-compact .menu-item.active::before { display: none; }
.sidebar-compact .menu-item.active::after { content: ''; position: absolute; right: 11px; top: 50%; width: 4px; height: 4px; background: var(--reis-gold); border-radius: 50%; transform: translateY(-50%); }
.sidebar-compact .menu-item.active .menu-icon { color: #fff; background: transparent; }
.sidebar-compact .menu-icon { background: transparent; font-size: 17px; }
.sidebar-compact .sidebar-bottom { border-color: #dce0d2; }
.sidebar-compact .sidebar-security, .sidebar-compact .sidebar-security strong, .sidebar-compact .sidebar-security span { color: #78836f; }
.sidebar-compact .sidebar-security > i { color: #6b7e60; }
.sidebar-compact .logout-button { background: #fff9; border-color: #d6dccb; color: #566454; border-radius: 8px; }
.sidebar-compact .logout-button:hover { color: var(--reis-primary); background: #fff; }
.sidebar-compact button:focus-visible, .sidebar-compact .menu-item:focus-visible { outline-color: var(--reis-primary); }
.sidebar-close, .sidebar-mobile-open, .mobile-menu-button { color: var(--reis-primary); border-color: var(--reis-border); background: #fff; box-shadow: none; }
.sidebar-close:hover { background: var(--reis-tint); }
.sidebar-backdrop:not([hidden]) { background: #263b2d55; }
@media (min-width: 901px) {
    .sidebar-compact:is(:hover, :focus-within) .sidebar-brand-logo { flex-basis: 56px; width: 56px; }
    .sidebar-compact:is(:hover, :focus-within) .sidebar-logo-monogram { display: none; }
    .sidebar-compact:is(:hover, :focus-within) .sidebar-logo-full { display: block; }
    .sidebar-compact:not(:hover):not(:focus-within) .menu-group-title { height: 8px; margin-top: 7px; margin-bottom: 3px; }
    .sidebar-compact:not(:hover):not(:focus-within) .menu-item.active::after { display: none; }
}
@media (max-width: 900px) {
    .sidebar-compact .sidebar-brand-logo { flex-basis: 56px; width: 56px; }
    .sidebar-compact .sidebar-logo-monogram { display: none; }
    .sidebar-compact .sidebar-logo-full { display: block; }
}

/* Cabeçalhos e superfícies. */
.main-content { background: var(--reis-canvas); min-width: 0; }
.topbar { min-height: 68px; padding-top: 14px; padding-bottom: 14px; background: #fff; border-bottom: 1px solid var(--reis-border); box-shadow: none; }
.topbar-user span { color: var(--reis-muted); font-size: 11px; }
.topbar-user strong { color: var(--reis-ink); font-size: 13px; font-weight: 600; }
.top-avatar, .user-avatar { color: var(--reis-primary); background: var(--reis-tint); }
.account-wrapper { position: relative; margin-left: auto; }
.account-menu { position: relative; }
.account-trigger { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; border-radius: 9px; padding: 4px 6px 4px 12px; color: var(--reis-ink); transition: background .15s; }
.account-trigger::-webkit-details-marker { display: none; }
.account-trigger:hover, .account-menu[open] .account-trigger { background: var(--reis-soft); }
.account-trigger:focus-visible { outline: 2px solid #719260; outline-offset: 3px; }
.account-copy { display: grid; gap: 1px; text-align: right; }
.account-copy > span { color: var(--reis-muted); font-size: 10px; }
.account-copy strong { font-size: 13px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar { display: grid; place-items: center; position: relative; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; background: var(--reis-tint); color: var(--reis-primary); overflow: hidden; }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-avatar img[hidden] { display: none; }
.account-chevron { color: var(--reis-muted); transition: transform .15s; }
.account-menu[open] .account-chevron { transform: rotate(180deg); }
.account-popover { position: absolute; z-index: 1200; top: calc(100% + 10px); right: 0; width: 248px; max-width: calc(100vw - 32px); padding: 7px; border: 1px solid var(--reis-border); border-radius: 11px; background: #fff; box-shadow: 0 9px 28px #25362e12; }
.account-identity { display: grid; gap: 3px; padding: 10px 12px 13px; margin-bottom: 5px; border-bottom: 1px solid var(--reis-border); overflow-wrap: anywhere; }
.account-identity strong { font-size: 12px; font-weight: 600; }
.account-identity > span { color: var(--reis-muted); font-size: 10px; }
.account-popover > a, .account-popover button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; color: #43563f; text-decoration: none; text-align: left; font-size: 12px; cursor: pointer; }
.account-popover > a:hover, .account-popover button:hover { background: var(--reis-soft); color: var(--reis-primary); }
.account-link-arrow { margin-left: auto; font-size: 9px; color: #90a080; }
.account-popover form { border-top: 1px solid var(--reis-border); margin-top: 5px; padding-top: 5px; }
#alterar-senha { scroll-margin-top: 85px; }
:is(.dashboard-page, .clientes-page, .orcamentos-page, .pedido-page, .pedidos-page, .usuarios-page, .perfil-page, .flow-page) { padding: 28px 30px; }
.flow-page { max-width: 1560px; }
:is(.page-heading, .pedido-heading, .flow-heading) { margin-bottom: 24px; }
:is(.page-heading, .pedido-heading, .flow-heading, .welcome-area) h1 { color: var(--reis-ink); font-size: clamp(25px, 2.2vw, 31px); font-weight: 600; letter-spacing: -.8px; }
:is(.page-label, .flow-eyebrow, .welcome-label, .budget-overview-label, .quick-client-eyebrow, .login-label) { color: #687f5c; font-weight: 550; letter-spacing: 1.4px; }
:is(.page-heading, .pedido-heading, .flow-heading, .panel-header, .form-card-header, .clients-card-header, .users-card-header, .pedido-card-header, .content-card-header) p { color: var(--reis-muted); line-height: 1.7; }
:is(.stat-card, .dashboard-panel, .search-card, .filter-card, .clients-card, .users-card, .summary-card, .form-card, .content-card, .pedido-card, .info-card, .flow-card, .orcamento-card, .budget-overview, .quick-client-dialog, .first-access-card, .denied-card) {
    color: var(--reis-ink); background: var(--reis-surface); border: 1px solid var(--reis-border); border-radius: var(--reis-radius); box-shadow: none;
}
:is(.stat-card, .orcamento-card):hover { box-shadow: none; transform: none; border-color: #b7c5b0; }
:is(.form-card-header, .clients-card-header, .users-card-header, .pedido-card-header, .content-card-header, .budget-overview-head, .panel-header, .access-section-header) { background: transparent; border-color: var(--reis-border); }
:is(.form-card-header, .clients-card-header, .users-card-header, .pedido-card-header, .content-card-header, .panel-header) h2 { color: var(--reis-ink); font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
:is(.flow-card, .stat-card, .dashboard-panel, .search-card, .filter-card) { padding: 22px; }
.flow-card h2 { color: var(--reis-ink); font-size: 17px; font-weight: 600; }
.flow-muted { color: var(--reis-muted); }
:is(.form-header-icon, .form-card-icon, .clients-icon, .users-card-icon, .section-icon, .card-header-icon, .header-icon, .stat-icon, .quick-action-icon, .system-icon, .client-avatar, .empty-icon, .card-icon, .quick-icon) { background: var(--reis-tint); color: var(--reis-primary); border-radius: 9px; box-shadow: none; }
.heading-icon { background: var(--reis-tint); color: var(--reis-primary); border: 1px solid var(--reis-border); border-radius: 10px; box-shadow: none; }
.profile-summary { border-color: var(--reis-border); border-radius: var(--reis-radius); }
.profile-summary-top { color: var(--reis-ink); background: var(--reis-soft); border-bottom: 1px solid var(--reis-border); }
.profile-summary-top strong { color: var(--reis-ink); }
.profile-summary-top > span { color: var(--reis-muted); background: #e4eadb; border-color: #d5dfc9; }
.profile-avatar { color: var(--reis-primary); background: #e6edde; border-color: #d0ddc3; box-shadow: none; }
:is(.compact-label, .form-label, .flow-page label, .info-label, .section-title, .access-section-title strong) { color: #50614e; font-weight: 500; }
.flow-tag, .base-badge, .unidade-badge { color: var(--reis-primary); background: var(--reis-tint); border-radius: 6px; }
.flow-empty { color: var(--reis-muted); background: #ffffff80; border-color: #cfd6c5; border-radius: var(--reis-radius); }
.flow-assignments, .observacoes-box, .access-section, .items-section, .system-item, .workflow-box { background: var(--reis-soft); border-color: var(--reis-border); }
.flow-split, .form-section, .flow-files li, .financial-form-head { border-color: var(--reis-border); }
.flow-file-input { background: #fafbf7; border-color: #c1cdb7; }
.direct-seller { border-color: #9fb293; }
.direct-summary .direct-grand-total { color: var(--reis-primary); border-color: var(--reis-border); }
.direct-grand-total dt, .direct-item-result strong { color: var(--reis-primary); }

/* Leitura mais simples no painel inicial. */
.welcome-card { background: transparent; color: var(--reis-ink); padding: 4px 0 26px; border: 0; border-radius: 0; box-shadow: none; margin-bottom: 0; }
.welcome-card::before, .welcome-card::after { display: none; }
.welcome-card h1 { color: var(--reis-ink); font-weight: 600; font-size: clamp(27px, 2.5vw, 34px); letter-spacing: -.9px; }
.welcome-card p { color: var(--reis-muted); max-width: 640px; }
.welcome-label { color: #687f5c; }
.stat-label { color: var(--reis-muted); font-size: 10px; letter-spacing: .9px; }
.stat-value { color: var(--reis-ink); font-weight: 600; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat-description, .quick-action-info span { color: var(--reis-muted); }
.stat-arrow { color: #7d9473; }
.quick-action { background: transparent; border-color: var(--reis-border); border-radius: 8px; color: var(--reis-ink); }
.quick-action:hover { background: var(--reis-soft); transform: none; border-color: #bdcbb3; }
.quick-action-info strong, .quick-action strong, .system-item strong { color: var(--reis-ink); }

/* Ações principais e secundárias compartilham o mesmo padrão. */
:is(.btn-new, .btn-new-order, .btn-save, .btn-create, .save-button, .new-user-button, .btn-action-dark, .quick-client-primary, .login-submit, .login-button, .dashboard-button, .photo-save-button, .apply-button),
.flow-btn.primary, .flow-btn.selected, .status-btn.active, .edit-users-button.active {
    background: var(--reis-primary); color: #fff; border-color: var(--reis-primary); border-radius: 7px; box-shadow: none; font-weight: 550;
}
:is(.btn-new, .btn-new-order, .btn-save, .btn-create, .save-button, .new-user-button, .btn-action-dark, .quick-client-primary, .login-submit, .login-button, .dashboard-button, .photo-save-button, .apply-button):hover,
.flow-btn.primary:hover, .flow-btn.selected:hover, .status-btn.active:hover { background: var(--reis-primary-hover); color: #fff; border-color: var(--reis-primary-hover); transform: none; box-shadow: none; }
:is(.btn-back, .btn-cancel, .cancel-button, .btn-action-outline, .print-button, .edit-users-button, .edit-user-button, .quick-client-secondary),
.flow-btn:not(.primary):not(.selected):not(.danger) { background: #fff; color: var(--reis-primary); border-color: #ccd5c3; border-radius: 7px; box-shadow: none; }
:is(.btn-back, .btn-cancel, .cancel-button, .btn-action-outline, .print-button, .edit-user-button, .quick-client-secondary):hover,
.flow-btn:not(.primary):not(.selected):not(.danger):hover { background: var(--reis-soft); color: var(--reis-primary); border-color: #aebfa2; transform: none; }
.edit-users-button.active { background: var(--reis-primary); color: #fff; }
:is(.quick-client-trigger, .compact-back, .flow-back, .origin-link, .item-medida, .entry-measure-label) { color: var(--reis-primary); }
.action-button:not(.action-delete), .item-action { color: var(--reis-primary); background: #fff; border-color: var(--reis-border); }
.status-btn:not(.active) { color: #65725d; background: #fff; border-color: var(--reis-border); }
.status-btn:not(.active):hover { background: var(--reis-soft); }

/* Campos e tabelas: bordas leves e estados de foco consistentes. */
:is(.form-control, .form-select, .compact-control, .grid-input, .grid-select, .login-field input, .quick-client-fields input),
.flow-page input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .flow-page select, .flow-page textarea {
    color: var(--reis-ink); background: #fff; border-color: #cbd2c1; border-radius: 7px; box-shadow: none;
}
:is(.form-control, .form-select, .compact-control, .grid-input, .grid-select, .login-field input, .quick-client-fields input):focus,
.flow-page input:focus, .flow-page select:focus, .flow-page textarea:focus { outline: 0; border-color: #65815b; box-shadow: 0 0 0 3px #294d4010; }
.compact-readonly, .budget-read-item { color: var(--reis-ink); }
.select2-container--bootstrap-5 .select2-selection { border-color: #cbd2c1; border-radius: 7px; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection { border-color: #65815b; box-shadow: 0 0 0 3px #294d4010; }
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] { background: var(--reis-primary); color: #fff; }
.input-box { border-color: #cbd2c1; background: #fff; }
.input-box:focus-within { border-color: #65815b; box-shadow: 0 0 0 3px #294d4010; }
.table { --bs-table-color: var(--reis-ink); --bs-table-bg: #fff; --bs-table-border-color: var(--reis-border); }
.table thead th, .spreadsheet-table thead th, .flow-table th { color: #5f6e57; background: var(--reis-soft); border-color: var(--reis-border); font-weight: 550; }
.table tbody td, .spreadsheet-table tbody td, .flow-table td { color: var(--reis-ink); border-color: var(--reis-border); }
.table tbody tr:hover, .spreadsheet-table tbody tr:hover { background: #f5f7f0; }
.table tbody tr:hover td { background-color: #f5f7f0; }
.spreadsheet-table thead th { font-size: 9px; padding-top: 10px; padding-bottom: 10px; }
.spreadsheet-table tbody td { font-size: 10px; }
.spreadsheet-help { color: var(--reis-muted); border-color: var(--reis-border); background: #fafbf7; }
.material-table-title, .pedido-secao-title { background: #edf1e7; color: var(--reis-primary); border-color: var(--reis-border); }
.inline-editing { background: #f1f5e9; }
.item-delete:hover, .action-delete:hover { background: #fff1ed; border-color: #e3bdb2; color: #a33f32; }

/* Resumo do orçamento em superfície clara, sem o antigo bloco escuro. */
.totals-card { color: var(--reis-ink); background: #fff; border: 1px solid var(--reis-border); border-top: 3px solid var(--reis-primary); border-radius: 10px; box-shadow: none; }
.totals-title { color: var(--reis-primary); font-weight: 600; }
.totals-card .total-row { color: var(--reis-muted); }
.totals-card .total-row strong { color: var(--reis-ink); }
.totals-card .form-label { color: #56694f; }
.totals-card .input-group-text { background: var(--reis-soft); border-color: #cbd2c1; color: var(--reis-muted); }
.totals-card .percent-form { border-color: var(--reis-border); }
.totals-card .total-final { color: var(--reis-primary); border-color: var(--reis-border); }
.totals-card .total-final strong { color: var(--reis-primary); }
.totals-card .financial-save-status { color: var(--reis-muted); }
.totals-card .financial-save-status.success { color: #3c7550; }
.totals-card .financial-save-status.error { color: #a33f32; }

/* Acesso e conta acompanham a mesma linguagem das telas internas. */
.login-page { background: var(--reis-canvas); }
.login-header h1 { color: var(--reis-ink); font-family: inherit; font-weight: 550; letter-spacing: -1.1px; }
.login-header .eyebrow, .login-field label, .password-toggle { color: var(--reis-primary); }
.login-field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px #fff inset; -webkit-text-fill-color: var(--reis-ink); }
.password-toggle:hover { background: var(--reis-tint); color: var(--reis-primary); }
.login-footer { color: var(--reis-muted); border-color: var(--reis-border); }
.login-intro, .login-security { color: var(--reis-muted); }
.auth-visual { background: var(--reis-primary); }
.auth-login, .register-panel { background: var(--reis-canvas); }
.auth-visual .shape { opacity: .3; }
.visual-label, .visual-message h1 > span { color: #d6dfc2; }
.brand-symbol { background: #e9eddf; color: var(--reis-primary); }
.form-area label { color: #50614e; }
.first-access-card h1, .denied-card h1 { color: var(--reis-ink); }
button:focus-visible, a:focus-visible { outline: 2px solid #719260; outline-offset: 3px; }
@media (max-width: 700px) {
    .account-copy > span { display: none; }
    .account-copy strong { max-width: 105px; font-size: 12px; }
    .account-trigger { gap: 8px; padding-left: 7px; }
    :is(.dashboard-page, .clientes-page, .orcamentos-page, .pedido-page, .pedidos-page, .usuarios-page, .perfil-page, .flow-page) { padding: 20px 16px; }
    :is(.flow-card, .stat-card, .dashboard-panel, .search-card, .filter-card) { padding: 18px; }
    .topbar { min-height: 62px; padding-left: 18px; padding-right: 18px; }
    .welcome-card { padding-top: 0; padding-bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
