/* Diárias — compat helpers (Alpine modals, alerts, inline table UI) */

.alert-error-custom,
.alert-warning-custom,
.alert-info-custom {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
    font-size: 0.86rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-error-custom {
    background: #fdecec;
    color: #9b1c1c;
    border: 1px solid #f5c2c2;
}

.alert-warning-custom {
    background: #fff7e6;
    color: #8a5a00;
    border: 1px solid #f5d78a;
}

.alert-info-custom {
    background: #e8f1fb;
    color: #1e4d8c;
    border: 1px solid #b6d0f0;
}

html[data-theme="dark"] .alert-error-custom {
    background: rgba(220, 80, 80, 0.15);
    color: #f5a8a8;
    border-color: rgba(220, 80, 80, 0.3);
}

html[data-theme="dark"] .alert-warning-custom {
    background: rgba(234, 179, 8, 0.12);
    color: #f5d078;
    border-color: rgba(234, 179, 8, 0.28);
}

html[data-theme="dark"] .alert-info-custom {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.28);
}

.export-modal-dialog-lg {
    max-width: 36rem;
}

.export-modal-dialog-scroll {
    max-height: 85vh;
    overflow-y: auto;
}

.detail-sections {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    padding: 1.15rem 1.25rem 1.35rem;
}

.detail-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.detail-grid .form-span-2,
.detail-span-2 {
    grid-column: 1 / -1;
}

.detail-label {
    margin: 0 0 0.15rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.detail-value {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-primary);
}

.detail-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    padding: 0.85rem;
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown-trigger {
    height: 40px;
    padding: 0 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.84rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.filter-dropdown-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    min-width: 12rem;
    padding: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
}

.filter-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-check:hover {
    background: var(--bg-hover);
}

.row-afastado,
.row-bloqueado {
    opacity: 0.55;
    background: var(--bg-muted);
}

.row-operacao > td {
    background: rgba(59, 130, 246, 0.06);
}

.row-operacao > td:first-child {
    box-shadow: inset 3px 0 0 #3b82f6;
}

.op-lista {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    border-radius: 10px;
    margin-bottom: 0.9rem;
}

.op-lista-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 0;
    border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.06));
    background: transparent;
    color: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
}

.op-lista-item:hover {
    background: var(--bg-hover);
}

.op-lista-item.is-selected {
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 var(--green-700);
}

.badge-operacao {
    margin-left: 0.35rem;
    font-size: 0.62rem;
    padding: 0.12rem 0.45rem;
    vertical-align: middle;
}

.row-obs-input {
    margin-top: 0.35rem;
    min-width: 140px;
    width: 100%;
    font-size: 0.78rem;
}

.row-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.status-embarcado { color: var(--green-600); }
.status-desembarcado { color: #b45309; }
.status-afastado { color: #b42318; }
.status-alert { color: #c2410c; }

html[data-theme="dark"] .status-embarcado { color: var(--green-300); }
html[data-theme="dark"] .status-desembarcado { color: #f5d078; }
html[data-theme="dark"] .status-afastado { color: #f5a8a8; }

.text-provento { color: var(--green-600); font-weight: 600; }
.text-desconto { color: #c2410c; font-weight: 600; }
.text-resultado-neg { color: #b42318; font-weight: 700; }

html[data-theme="dark"] .text-provento { color: var(--green-300); }
html[data-theme="dark"] .text-desconto { color: #f5a078; }
html[data-theme="dark"] .text-resultado-neg { color: #f5a8a8; }

.table-control {
    height: 34px;
    min-width: 110px;
    padding: 0 0.55rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.table-control-sm {
    width: 6rem;
    min-width: 0;
}

.hint-tiny {
    margin: 0.25rem 0 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    max-width: 140px;
    line-height: 1.25;
}

.btn-info-row {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    font-style: italic;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
}

.btn-info-row:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.panel-footer-meta {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-muted);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-narrow {
    max-width: 28rem;
}

.form-medium {
    max-width: 32rem;
}

.users-layout {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
    gap: 1rem;
}

@media (max-width: 1100px) {
    .users-layout {
        grid-template-columns: 1fr;
    }
}

.user-list {
    display: flex;
    flex-direction: column;
}

.user-list-item {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
}

.user-list-item:last-child {
    border-bottom: 0;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.user-row-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email {
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.form-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.empty-cell {
    padding: 2.5rem 1rem !important;
    text-align: center;
    color: var(--text-muted);
}

.code-inline {
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    background: var(--bg-muted);
    font-size: 0.75rem;
}

.stats-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .stats-row-3 {
        grid-template-columns: 1fr;
    }
}

.export-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.mb-1 { margin-bottom: 0.85rem; }
.mt-1 { margin-top: 0.85rem; }

.hidden-forms {
    display: none;
}

.pagination-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.75rem 1rem 1rem;
}

.htmx-flash {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 4000;
  max-width: 22rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.86rem;
  box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,.12));
  animation: htmxFlashIn 0.2s ease;
}

.htmx-flash[hidden] { display: none !important; }

.htmx-flash-ok {
  background: #e8f7ee;
  color: #166534;
  border: 1px solid #b7e4c7;
}

.htmx-flash-err {
  background: #fdecec;
  color: #9b1c1c;
  border: 1px solid #f5c2c2;
}

@keyframes htmxFlashIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

tr.row-just-saved td {
  background: rgba(34, 120, 70, 0.08);
  transition: background 0.8s ease;
}

.htmx-request.btn-primary-green,
.htmx-request.btn-outline-green {
  opacity: 0.65;
  pointer-events: none;
}

.motorista-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 220px;
  flex: 1 1 220px;
  max-width: 320px;
}

.motorista-search-input {
  width: 100%;
  padding-right: 2.2rem !important;
  min-width: 220px;
}

.motorista-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted, #6b7280);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  z-index: 2;
}

.motorista-search-clear:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary, #111);
}

.motorista-search-clear[hidden] {
  display: none !important;
}

.motorista-search-spin {
  position: absolute;
  right: 2.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--green-600, #2f6b45);
  font-size: 0.9rem;
  display: none;
  pointer-events: none;
}

.motorista-search-spin.htmx-request,
.htmx-request .motorista-search-spin,
.motorista-search-spin.htmx-indicator.htmx-request {
  display: inline-flex;
}

/* htmx indicator: hidden by default, shown during request */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
  display: inline-flex;
  animation: motoristaSpin 0.7s linear infinite;
}

@keyframes motoristaSpin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* ── Densidade intermediária (listagem de diárias) ── */
body.page-dense .page-header {
  padding: 0.75rem 1.25rem 0.2rem;
}

body.page-dense .page-header-row {
  gap: 0.55rem;
  align-items: center;
}

body.page-dense .page-title {
  font-size: 1.32rem;
}

body.page-dense .page-sub {
  margin-top: 0.15rem;
  font-size: 0.82rem;
}

body.page-dense .page-header-meta {
  gap: 0.45rem;
}

body.page-dense .main-content {
  padding: 0.45rem 1.25rem 1.5rem;
}

body.page-dense .filters-bar {
  gap: 0.45rem;
  margin: 0.55rem 0 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
}

body.page-dense .page-header > .filters-bar,
body.page-dense .page-header > .filtros-pin-spacer + .filters-bar {
  margin-bottom: 0.4rem;
}

body.page-dense .header-periodo-select,
body.page-dense .header-date-input,
body.page-dense .filter-dropdown-trigger,
body.page-dense .header-filtrar-btn,
body.page-dense .btn-primary-green,
body.page-dense .btn-outline-green,
body.page-dense .btn-ghost {
  height: 36px;
  font-size: 0.82rem;
  border-radius: 8px;
}

body.page-dense .header-periodo-select,
body.page-dense .header-date-input {
  padding: 0 0.65rem;
}

body.page-dense .header-filtrar-btn,
body.page-dense .btn-primary-green,
body.page-dense .btn-outline-green {
  padding: 0 0.8rem;
  gap: 0.35rem;
}

body.page-dense .btn-sm {
  height: 30px;
  padding: 0 0.6rem;
  font-size: 0.74rem;
  border-radius: 7px;
}

body.page-dense .btn-icon {
  width: 30px;
  height: 30px;
}

body.page-dense .filter-dropdown-trigger {
  padding: 0 0.7rem;
  font-size: 0.82rem;
}

body.page-dense .motorista-search {
  min-width: 210px;
  max-width: 300px;
}

body.page-dense .motorista-search-input {
  min-width: 210px;
  padding-right: 2rem !important;
}

body.page-dense .panel-card {
  margin-bottom: 0.75rem;
  border-radius: 10px;
}

body.page-dense .panel-card-header {
  padding: 0.55rem 0.85rem;
}

body.page-dense .panel-card-header h2 {
  font-size: 0.9rem;
}

body.page-dense .badge-pill {
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
}

body.page-dense .data-table {
  font-size: 0.82rem;
}

body.page-dense .data-table thead th {
  padding: 0.55rem 0.7rem;
  font-size: 0.7rem;
}

body.page-dense .data-table td {
  padding: 0.5rem 0.7rem;
}

body.page-dense .table-control {
  height: 32px;
  min-width: 110px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  border-radius: 7px;
}

body.page-dense .table-control-sm {
  width: 5.75rem;
}

body.page-dense .row-meta {
  font-size: 0.68rem;
  margin-top: 0.1rem;
  line-height: 1.25;
}

body.page-dense .fw-semibold {
  font-size: 0.82rem;
  line-height: 1.25;
}

body.page-dense .hint-tiny {
  margin-top: 0.18rem;
  font-size: 0.62rem;
  max-width: 140px;
  line-height: 1.2;
}

body.page-dense .row-obs-input {
  margin-top: 0.25rem;
  height: 28px;
}

body.page-dense .btn-info-row {
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
}

body.page-dense .panel-footer-meta {
  padding: 0.5rem 0.85rem;
  font-size: 0.74rem;
}

body.page-dense .pagination-bar {
  padding: 0.5rem 0.85rem;
  gap: 0.45rem;
}

body.page-dense .table-actions {
  gap: 0.35rem;
}

.results-header-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted, #6b7280);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.page-size-label {
  opacity: 0.85;
}

.page-size-select {
  height: 26px;
  min-width: 4.2rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: var(--bg-surface, #fff);
  color: var(--text-secondary, #4b5563);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.page-size-select:hover,
.page-size-select:focus {
  border-color: var(--green-500, #3d8a55);
  color: var(--green-800, #1f4d32);
}

/* Fixar filtros no topo */
.filters-bar-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  width: 100%;
}

.filters-pin-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #6b7280);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filters-pin-btn:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.05));
  color: var(--green-700, #2f6b45);
  border-color: var(--border, #e5e7eb);
}

.filters-pin-btn.is-active {
  color: var(--green-800, #1f4d32);
  background: rgba(61, 138, 85, 0.12);
  border-color: rgba(61, 138, 85, 0.28);
}

.filtros-pin-spacer {
  display: block;
  width: 100%;
  pointer-events: none;
}

.filtros-pin-spacer[hidden] {
  display: none !important;
}

#filtros-sticky.is-pinned {
  position: fixed;
  top: 0;
  left: var(--sidebar-w-collapsed, 78px);
  right: 0;
  z-index: 250;
  margin: 0 !important;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 28px rgba(15, 40, 25, 0.14);
  border-top: 0;
  background: var(--bg-surface, #fff);
}

body.sidebar-expanded #filtros-sticky.is-pinned {
  left: var(--sidebar-w, 248px);
}

@media (max-width: 900px) {
  #filtros-sticky.is-pinned,
  body.sidebar-expanded #filtros-sticky.is-pinned {
    left: var(--sidebar-w-collapsed, 78px);
  }
}



/* Menu lateral: grupo Diárias com sublista + separação do Quadro */
.sidebar-group { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-group-toggle { position: relative; }
.sidebar-group.has-active > .sidebar-group-toggle { color: #fff; font-weight: 600; }
.sidebar-caret {
  margin-left: auto;
  font-size: 0.8rem !important;
  width: auto !important;
  opacity: 0.75;
  transition: transform var(--transition, 0.2s ease);
}
.sidebar-group.is-open .sidebar-caret { transform: rotate(180deg); }
body:not(.sidebar-expanded) .sidebar-caret { display: none; }

.sidebar-sub {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
}
.sidebar-group.is-open .sidebar-sub { display: flex; }
body.sidebar-expanded .sidebar-sub {
  margin-left: 1.25rem;
  padding-left: 0.6rem;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
body:not(.sidebar-expanded) .sidebar-sub {
  background: rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  padding: 0.2rem 0;
}
.sidebar-sublink { min-height: 38px; padding-top: 0.45rem; padding-bottom: 0.45rem; font-size: 0.92rem; }
.sidebar-sublink i { font-size: 1rem !important; }

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0.6rem 0.4rem;
  flex-shrink: 0;
}

/* Menu lateral: logo menor, rodapé compacto e rolagem discreta */
.sidebar-top { min-height: 58px; padding: 0.7rem 0.75rem 0.45rem; }
body.sidebar-expanded .sidebar-logo-full { max-height: 30px; }
body:not(.sidebar-expanded) .sidebar-logo-collapsed { width: 32px; height: 32px; max-width: 32px; max-height: 32px; }
.sidebar-toggle { top: 16px; height: 36px; }

.sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-button { display: none; height: 0; }

.sidebar-footer { margin-top: auto; padding: 0.4rem 0.65rem 0.6rem; gap: 0.1rem; }
.sidebar-footer .sidebar-link,
.sidebar-footer .sidebar-theme-btn { min-height: 34px; padding-top: 0.35rem; padding-bottom: 0.35rem; font-size: 0.86rem; border-radius: 10px; }
.sidebar-footer .sidebar-link i,
.sidebar-footer .sidebar-theme-btn i { font-size: 0.95rem; }
