/* CalculaObra: white surfaces, amber brand and blue actions, matching Flutter. */
:root {
  color-scheme: light;
  --bg-dark: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #edf3fa;
  --border-color: #dee5ed;
  --text-primary: #212121;
  --text-secondary: #616d7c;
  --text-muted: #687583;
  --accent-color: #1976d2;
  --danger-color: #d32f2f;
  --success-color: #388e3c;
  --primary-dark: #c06800;
}
[hidden] {
  display: none !important;
}
body {
  background: var(--bg-dark);
}
.glass {
  background: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.shadow-soft {
  box-shadow: 0 5px 22px rgba(26, 53, 82, 0.06);
}
.sidebar {
  background: #fff;
}
.sidebar-header,
.app-header {
  background: #fdbc1a;
  color: #212121;
}
.sidebar-header span {
  color: #212121;
}
.app-header {
  box-shadow: 0 2px 10px rgba(26, 53, 82, 0.06);
}
.nav-item.active {
  background: #fff6d9;
  color: #875400;
  border-left-color: #fdbc1a;
}
.nav-item:hover {
  background: #f1f5f9;
  color: #1976d2;
}
.nav-item:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #1976d2;
  outline-offset: 3px;
}
.btn-primary {
  background: #1976d2;
  color: #fff;
  border-color: #1976d2;
}
.btn-primary:hover {
  background: #1565c0;
  color: #fff;
}
.btn-secondary {
  background: #fff;
  color: #2d4d6a;
  border-color: #d6dfe8;
}
.btn-secondary:hover {
  background: #edf3fa;
  color: #1565c0;
  border-color: #1976d2;
}
.btn-link {
  color: #1976d2;
}
.btn-danger {
  color: #b3261e;
  background: #fff0ee;
  border-color: #e7b9b6;
}
.manager-dialog,
.profile-dialog,
.modal-content {
  background: #fff;
  box-shadow: 0 18px 65px rgba(26, 53, 82, 0.18);
}
.manager-modal,
.profile-modal,
.modal-overlay {
  background: rgba(18, 35, 54, 0.46);
}
.manager-card {
  background: #fff;
}
.manager-card-cover {
  background: #fff8e5;
}
.manager-card-body h4 {
  color: #212121;
}
.manager-card-actions .btn-primary {
  color: #fff;
}
.icon-action {
  background: #f5f8fc;
  color: #38516b;
}
.icon-action:hover {
  border-color: #1976d2;
  color: #1976d2;
}
.status-pill {
  background: #eaf5ec;
  color: #286c33;
}
.enhancement-metric {
  background: #fff;
  box-shadow: 0 3px 15px rgba(26, 53, 82, 0.035);
}
.enhancement-metric-icon {
  color: #875400;
  background: #fff3cc;
}
.filter-result-summary {
  background: #fff6dc;
}
.filter-result-summary strong {
  color: #875400;
}
.project-mini-metric {
  background: #f5f7fa;
}
.project-mini-metric.balance-negative strong,
.enhancement-metric.danger .enhancement-metric-value {
  color: #b3261e;
}
.connection-pill {
  color: #286c33;
  background: #eaf5ec;
}
.connection-pill.offline {
  color: #b3261e;
  background: #fff0ee;
}
.kpi-card.budget {
  border-left-color: #1976d2;
}
.kpi-card.budget .kpi-icon {
  background: #eaf3fd;
  color: #1976d2;
}
.kpi-card.spent .kpi-icon {
  color: #875400;
  background: #fff3cc;
}
.kpi-card.spent {
  border-left-color: #fdbc1a;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea,
select,
.form-group input,
.form-group textarea,
.form-group select,
.search-input,
.select-filter,
.simple-control input,
.simple-control select,
.manager-dialog input,
.manager-dialog textarea,
.manager-dialog select {
  background: #fff !important;
  color: #212121 !important;
  border-color: #d6dfe8 !important;
  caret-color: #1976d2;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
input:focus,
textarea:focus,
select:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.search-input:focus,
.select-filter:focus,
.simple-control input:focus,
.simple-control select:focus,
.manager-dialog input:focus,
.manager-dialog textarea:focus,
.manager-dialog select:focus {
  background: #fff !important;
  border-color: #1976d2 !important;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12) !important;
}
select option,
select optgroup {
  background: #fff;
  color: #212121;
}
input::placeholder,
textarea::placeholder {
  color: #737d89;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):disabled,
input:disabled,
textarea:disabled,
select:disabled {
  background: #f1f5f9 !important;
  color: #687583 !important;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}
input[type="file"]::file-selector-button {
  background: #edf3fa;
  color: #2d4d6a;
}
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #212121 !important;
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
}
.dropdown-trigger {
  background: #fff;
  color: #212121;
  border-color: #e3aa10;
}
.dropdown-menu {
  background: #fff;
  box-shadow: 0 12px 32px rgba(26, 53, 82, 0.14);
}
.dropdown-item.selected {
  color: #875400;
  background: #fff6dc;
}
.dropdown-item:hover {
  background: #edf3fa;
}
.report-options {
  background: #fff;
}
.panel-report-scope {
  font-size: 12px;
  line-height: 1.7;
  color: #526273;
  margin: 15px 0;
}
.panel-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  font-size: 13px;
}
.profile-edit-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 22px 22px;
}
.profile-edit-form .form-group {
  flex: 1;
  margin: 0;
}
.profile-edit-form button {
  white-space: nowrap;
}
.profile-section .field-hint {
  line-height: 1.6;
  margin-bottom: 12px;
}
.panel-load-error {
  margin-bottom: 18px;
  padding: 16px;
  background: #fff0ee;
  color: #b3261e;
  border: 1px solid #e7b9b6;
  border-radius: 12px;
  line-height: 1.6;
}
.panel-modal-open {
  overflow: hidden;
}
.toast {
  box-shadow: 0 8px 30px rgba(26, 53, 82, 0.15);
  z-index: 14000;
}
#diary-timeline .diary-stage-badge,
#diary-timeline .timeline-notes strong,
#diary-timeline .timeline-date-marker i {
  color: #875400;
}
.profile-shortcut-cue {
  color: #875400;
}
#premium-gate {
  background: #f5f7fa;
}
.premium-card {
  background: #fff;
  border: 1px solid #dee5ed;
}
.premium-card .icon {
  color: #875400;
}
.premium-features-list i {
  color: #388e3c;
}
@media (max-width: 700px) {
  .profile-edit-form {
    flex-direction: column;
    align-items: stretch;
  }
  .manager-dialog-footer {
    gap: 8px;
  }
  .app-header {
    padding: 10px 14px;
    min-height: 70px;
    height: auto;
  }
  .panel-pagination {
    gap: 8px;
  }
  .panel-pagination .btn-secondary {
    padding: 10px;
  }
  .manager-dialog,
  .profile-dialog {
    max-height: 90dvh;
  }
}
@media print {
  .manager-modal,
  .profile-modal,
  .panel-pagination,
  .panel-load-error {
    display: none !important;
  }
  .panel-report-scope {
    color: #333;
  }
  .panel-modal-open {
    overflow: visible;
  }
}

#panel-menu-toggle,
.panel-nav-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s;
    z-index: 200;
  }
  .panel-sidebar-open .sidebar {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    min-width: 0;
    width: 100%;
  }
  #panel-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }
  .panel-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(18, 35, 54, 0.4);
    z-index: 150;
    border: 0;
  }
  .app-header {
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    height: auto;
  }
  .header-actions {
    margin-left: auto;
  }
  .project-selector-container {
    flex: 1;
    min-width: 0;
  }
  .project-switcher-controls {
    min-width: 0;
  }
  .dropdown-trigger {
    min-width: 0;
    max-width: 100%;
  }
  .content-area {
    padding: 18px;
    min-width: 0;
  }
  .kpis-grid {
    grid-template-columns: 1fr;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .table-header-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .printable-report {
    padding: 18px;
  }
  .report-meta {
    grid-template-columns: 1fr;
  }
  .report-summary {
    grid-template-columns: 1fr;
  }
}
@media print {
  #panel-menu-toggle,
  .panel-nav-backdrop {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .sidebar {
    display: none !important;
  }
}

.panel-data-loading {
  display: none;
  color: #526273;
  padding: 12px 0;
  font-size: 13px;
}
#app-layout[aria-busy="true"] .panel-data-loading {
  display: block;
}
#app-layout[aria-busy="true"] .kpi-details h2 {
  opacity: 0.5;
}
.report-category-total {
  font-size: 12px;
  line-height: 1.7;
  color: #333;
}
@media print {
  .panel-data-loading {
    display: none !important;
  }
}

#panel-account-confirm {
  z-index: 13000;
}
.kpi-card.spent h2 {
  color: #a96a00 !important;
}
.selector-label {
  color: #1565c0;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .app-header {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
  }
  .project-selector-container {
    width: 100%;
    min-width: 0;
  }
  .project-switcher-controls {
    width: 100%;
    min-width: 0;
  }
  .custom-dropdown {
    flex: 1;
    min-width: 0;
  }
  .dropdown-trigger {
    width: 100%;
    min-width: 0;
  }
  .btn-switcher-arrow {
    flex-shrink: 0;
  }
  .header-actions {
    grid-column: 1/-1;
    margin: 0;
    justify-content: flex-end;
    width: 100%;
  }
  .kpi-panel {
    padding: 0;
  }
  .report-summary-cards {
    grid-template-columns: 1fr;
  }
  .timeline-card-header {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .tab-screen,
  .modal-overlay {
    transition: none;
    animation: none;
  }
}

.badge.category,
#user-plan {
  color: #875400 !important;
}
.table-responsive td[style*="primary-color"] {
  color: #875400 !important;
}

/* Os indicadores pertencem ao conteúdo do Resumo, que já tem margens próprias. */
#summary-screen > .kpi-panel {
  padding: 0;
  margin-bottom: 24px;
}

/* A instalação ocupa espaço próprio antes do usuário, sem sobrepor o rodapé. */
.sidebar > .pwa-install-button {
  position: static;
  inset: auto;
  flex-shrink: 0;
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  min-height: 40px;
  box-shadow: none;
}
.sidebar-header,
.sidebar-footer {
  flex-shrink: 0;
}
.sidebar-nav {
  min-height: 0;
  overflow-y: auto;
}
.panel-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  height: 28px;
  white-space: nowrap;
  padding: 0 10px;
  border: 1px solid rgba(25, 118, 210, 0.16);
  border-radius: 20px;
  background: #eaf3fd;
  color: #1976d2;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.header-actions {
  gap: 10px;
  flex-wrap: wrap;
}
@media print {
  .pwa-install-button,
  .panel-version { display: none !important; }
}

.project-switcher-controls > .project-manage-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}
.project-manage-button i { font-size: 12px; }

.manager-active-project {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 7px;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  box-sizing: border-box;
  border: 1px solid #cbe4d0;
  border-radius: var(--border-radius);
  background: #eaf5ec;
  color: #286c33;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* A marca forma uma faixa contínua entre navegação e cabeçalho. */
.sidebar.glass{background:#fdbc1a;border:0}
.sidebar-header{border-bottom:0;background:#fdbc1a}
.app-header{background:#fdbc1a;border-bottom:0;box-shadow:none;flex-shrink:0}
.sidebar .nav-item{color:#195b98;border-left:3px solid transparent}
.sidebar .nav-item:hover{background:rgba(255,255,255,.35);color:#124d85}
.sidebar .nav-item.active{background:#fff;color:#195b98;border-left-color:#1976d2;border-radius:10px;box-shadow:0 3px 12px rgba(120,82,0,.08)}
.sidebar-footer{background:rgba(255,255,255,.17);border-top:1px solid rgba(98,66,0,.16)}
.sidebar .btn-logout{color:#493b1c}
.sidebar .btn-logout:hover{color:#a42c20;background:rgba(255,255,255,.3)}
.sidebar>.pwa-install-button{background:#fff6db;color:#493b1c;border:1px solid rgba(98,66,0,.16)}
@media(min-width:901px){
  .sidebar-header,.app-header{height:var(--header-height);min-height:var(--header-height);max-height:var(--header-height)}
}

.sidebar-header span,.sidebar .user-info .name,.sidebar .btn-logout{color:#195b98}
.sidebar #user-plan{color:#195b98!important}
.sidebar>.pwa-install-button{color:#195b98}

/* Cabeçalho contínuo e controles com a mesma altura. A página continua rolável. */
html,body{scrollbar-width:none}
html::-webkit-scrollbar,body::-webkit-scrollbar{width:0;height:0;display:none}
.app-header.glass{border:0}
.app-header .btn-switcher-arrow,
.app-header .dropdown-trigger,
.app-header .project-manage-button,
.app-header .connection-pill,
.app-header .panel-version,
.app-header #btn-open-modal{
  box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;
  height:36px;min-height:36px;max-height:36px;padding-top:0;padding-bottom:0;
  border-width:1px;border-style:solid;border-radius:12px;line-height:1;font-size:12px;
}
.app-header .dropdown-trigger{justify-content:space-between}
.app-header .connection-pill{gap:6px;padding-left:12px;padding-right:12px;border-color:#cde6d2}
.app-header .connection-pill.offline{border-color:#efd1cb}
.app-header .panel-version{padding-left:12px;padding-right:12px}
.app-header #btn-open-modal{padding:0 16px!important;font-size:12px!important;gap:8px}
@media(min-width:1101px){
  .app-header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:16px;padding:8px 32px}
  .header-actions{flex-wrap:nowrap;align-items:center;gap:10px;margin:0}
}
@media(min-width:901px) and (max-width:1100px){
  .app-header{height:auto;max-height:none;padding:8px 16px;gap:10px;flex-wrap:wrap}
  .header-actions{flex-wrap:nowrap;margin-left:auto}
}

/* Curva interna no encontro do cabeçalho e do menu lateral. */
@media(min-width:901px){
  .main-wrapper{background:#fdbc1a}
  .content-area{background:var(--bg-dark);border-top-left-radius:24px}
}

/* Valores numéricos são editados por digitação, sem setas de incremento. */
input[type=number]{appearance:textfield;-moz-appearance:textfield}
input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}

/* A curva acompanha o cabeçalho fixo, inclusive com o conteúdo rolando. */
@media(min-width:901px){
  .app-header:after{content:'';position:absolute;left:0;top:100%;width:24px;height:24px;background:radial-gradient(circle at bottom right,transparent 24px,#fdbc1a 24.5px);pointer-events:none}
}

/* Cabeçalhos dos modais seguem a cor principal do painel. */
body :is(.modal-header,.manager-dialog-header,.profile-dialog-header,.panel-prompt-head){background:#fdbc1a;color:#195b98;border-bottom:1px solid #e8ad13}
body :is(.modal-header,.manager-dialog-header,.profile-dialog-header,.panel-prompt-head) :is(h2,h3){color:#195b98}
body :is(.modal-header,.manager-dialog-header,.profile-dialog-header) .btn-close-modal{color:#195b98;border-radius:8px}
body :is(.modal-header,.manager-dialog-header,.profile-dialog-header) .btn-close-modal:hover{color:#123f6e;background:#ffffff50}
body :is(.modal-header,.manager-dialog-header,.profile-dialog-header) .btn-close-modal:focus-visible{outline:2px solid #195b98;outline-offset:3px}
body .panel-prompt .panel-prompt-head{padding:18px 22px;margin-bottom:18px}

/* Hide modal scrollbars while retaining scrolling and keyboard access. */
:is(dialog,[role="dialog"],.modal-overlay,.modal-backdrop,.manager-modal,.profile-modal,.panel-prompt),
:is(dialog,[role="dialog"],.modal-overlay,.modal-backdrop,.manager-modal,.profile-modal,.panel-prompt) * {
  scrollbar-width: none !important;
  scrollbar-gutter: auto !important;
}
:is(dialog,[role="dialog"],.modal-overlay,.modal-backdrop,.manager-modal,.profile-modal,.panel-prompt)::-webkit-scrollbar,
:is(dialog,[role="dialog"],.modal-overlay,.modal-backdrop,.manager-modal,.profile-modal,.panel-prompt) *::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Monetary totals need readable text on white; amber remains the brand accent. */
#kpi-spent,#rep-spent{color:#875400!important}
#rep-balance{color:#237341!important}
.enhancement-metric.danger .enhancement-metric-icon{color:#b3261e;background:#fff0ee}
