/* === RESET & VARIABLES === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:  #1a5c4a;
  --green-mid:   #2d7a63;
  --green-light: #4ecfaa;
  --green-text:  #a8e8d4;
  --bg:          #f5f7f6;
  --white:       #ffffff;
  --text:        #222222;
  --text-muted:  #666666;
  --border:      #e0e0e0;
  --danger:      #c0392b;
  --danger-hover:#e74c3c;
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
  --radius:      8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* === HEADER / NAV === */
.app-header {
  background: var(--green-dark);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.app-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.app-logo .accent { color: var(--green-light); }

nav { display: flex; gap: 4px; margin-left: 16px; }

nav a {
  color: var(--green-text);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

nav a:hover  { background: rgba(255,255,255,0.1); color: #fff; }
nav a.active { background: rgba(255,255,255,0.15); color: #fff; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-name { font-size: 13px; color: var(--green-text); }

/* === BUTTONS === */
.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--green-dark); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-mid); }

.btn-outline { background: transparent; color: var(--green-dark); border: 1.5px solid var(--green-dark); }
.btn-outline:hover:not(:disabled) { background: var(--green-dark); color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-ghost { background: transparent; color: var(--green-text); padding: 6px 12px; font-weight: 500; }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* === MAIN LAYOUT === */
.page-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* === FILTERS === */
.filters {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.period-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.period-btn {
  background: var(--white);
  border: none;
  border-right: 1px solid var(--border);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.period-btn:last-child { border-right: none; }
.period-btn:hover  { background: #f0f0f0; }
.period-btn.active { background: var(--green-dark); color: #fff; }

.custom-dates { display: none; align-items: center; gap: 8px; }
.custom-dates.visible { display: flex; }

input[type="date"], .filter-select {
  padding: 7px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  outline: none;
  cursor: pointer;
}

input[type="date"]:focus,
.filter-select:focus { border-color: var(--green-dark); }

/* === SUMMARY CARDS === */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border-left: 4px solid var(--green-dark);
}

.summary-card .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #888;
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1;
}

.summary-card .summary-value-sm {
  font-size: 16px;
}

/* === TABLE CARD === */
.table-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible; /* não cortar dropdowns absolutos */
}

/* compensar a remoção do overflow:hidden — arredondar cantos da tabela */
thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius) 0 0; }
tbody tr:last-child td:first-child { border-radius: 0 0 0 var(--radius); }
tbody tr:last-child td:last-child  { border-radius: 0 0 var(--radius) 0; }

.table-toolbar {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar-filters {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-title {
  font-size: 13px;
  font-weight: 700;
  color: #444;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  background: var(--green-mid);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  user-select: none;
}

thead th.sortable { cursor: pointer; }
thead th.sortable:hover { background: var(--green-dark); }

.sort-icon { margin-left: 4px; opacity: 0.6; font-size: 10px; }
th.sorted-asc  .sort-icon::after { content: '▲'; }
th.sorted-desc .sort-icon::after { content: '▼'; }
th:not(.sorted-asc):not(.sorted-desc) .sort-icon::after { content: '⇅'; }

tbody tr { border-bottom: 1px solid #f0f0f0; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f7fdf9; }

td { padding: 10px 14px; font-size: 13px; color: #333; vertical-align: middle; }

.td-num   { text-align: right; font-variant-numeric: tabular-nums; }
.td-muted { color: #888; font-size: 12px; }
.td-bold  { font-weight: 600; }

/* === TABLE FOOTER === */
.table-footer {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  flex-wrap: wrap;
}

.total-label { font-size: 13px; color: #555; }
.total-value { font-size: 15px; font-weight: 700; color: var(--green-dark); }
.row-count   { font-size: 11px; color: #aaa; }

/* === PAGINATION === */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.page-btn {
  min-width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #555;
  padding: 0 6px;
  transition: background 0.1s, color 0.1s;
}

.page-btn:hover:not(:disabled) { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }
.page-btn.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === STATUS BADGE === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge::before { content: '●'; font-size: 8px; }

.badge-active   { background: #e6f7f0; color: #1a7a4a; }
.badge-inactive { background: #fde8e8; color: #c0392b; }
.badge-warning  { background: #fff8e1; color: #b7791f; }

/* === SEARCH === */
.search-input {
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  outline: none;
  width: 260px;
  margin-left: auto;
}

.search-input:focus { border-color: var(--green-dark); }

/* === STATE MESSAGE === */
.state-msg {
  text-align: center;
  padding: 48px 24px !important;
  color: #888;
  font-size: 14px;
}

.state-msg.error { color: var(--danger); }

/* === INLINE CONFIRM === */
.inline-confirm {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 12px;
  background: #fff5f5;
  border: 1px solid #fcc;
  border-radius: 6px;
  font-size: 12px;
  color: #c0392b;
  flex-wrap: wrap;
}

.inline-confirm.visible { display: flex; }

/* === LOGIN PAGE === */
.login-page {
  min-height: 100vh;
  background: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28);
}

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo-mark {
  font-size: 30px;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: -0.5px;
  line-height: 1;
}

.login-logo-mark .accent { color: var(--green-light); }

.login-subtitle {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--green-dark); }

.btn-login {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  background: var(--green-dark);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.btn-login:hover:not(:disabled) { background: var(--green-mid); }
.btn-login:disabled { background: #aaa; cursor: not-allowed; }

.forgot-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover { text-decoration: underline; }

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.alert-error   { background: #fde8e8; color: #c0392b; border: 1px solid #f5c6c6; }
.alert-success { background: #e6f7f0; color: #1a7a4a; border: 1px solid #b3e6d0; }
.alert-hidden  { display: none; }

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.visible { display: flex; }

.modal-card {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}

.modal-close:hover { background: #f0f0f0; color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  border-radius: 0 0 12px 12px;
}

/* === CURRENCY INPUT === */
.currency-input-wrapper {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.currency-input-wrapper:focus-within { border-color: var(--green-dark); }

.currency-prefix {
  padding: 10px 10px 10px 12px;
  font-size: 14px;
  color: #666;
  background: #f8f8f8;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.currency-input-wrapper .form-input {
  border: none;
  border-radius: 0;
  flex: 1;
}

.currency-input-wrapper .form-input:focus { border: none; }

/* === ACTIONS ROW === */
.actions-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* === RATE TAG (jobs) === */
.rate-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.rate-custom    { background: #e6f7f0; color: #1a7a4a; }
.rate-inherited { background: #e8f0fe; color: #1a56b0; }
.rate-none      { background: #f5f5f5; color: #999; }

/* === EFFECTIVE RATE HINT (modal jobs) === */
.effective-rate-hint {
  font-size: 12px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 5px;
  margin-top: -4px;
  margin-bottom: 12px;
}

.effective-rate-hint.rate-custom    { background: #e6f7f0; color: #1a7a4a; }
.effective-rate-hint.rate-inherited { background: #e8f0fe; color: #1a56b0; }
.effective-rate-hint.rate-none      { background: #f5f5f5; color: #999; }

/* === MODAL JOB INFO === */
.modal-job-info {
  font-size: 13px;
  color: var(--text-muted);
  background: #f8f8f8;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
}

/* === MULTI-SELECT FILTER === */
.multiselect-wrapper { position: relative; }

.multiselect-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  min-width: 180px;
  font-family: inherit;
  transition: border-color 0.12s;
}

.multiselect-btn:hover { border-color: #94a3b8; }
.multiselect-btn.has-selection { border-color: var(--green-dark); color: var(--green-dark); font-weight: 600; }

.multiselect-arrow { margin-left: auto; color: #9ca3af; font-size: 10px; }

.multiselect-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.13);
  z-index: 300;
}

.multiselect-dropdown.open { display: block; }

.multiselect-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.multiselect-clear {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-dark);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
}

.multiselect-clear:hover { background: #f0f0f0; }

.multiselect-list {
  height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.multiselect-divider { height: 1px; background: var(--border); margin: 2px 0; }

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.multiselect-option:hover { background: #f7fdf9; }

.multiselect-option input[type=checkbox] {
  accent-color: var(--green-dark);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* === BUDGET RADIO OPTIONS (modal jobs) === */
.budget-mode-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.budget-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.budget-radio input[type=radio] {
  accent-color: var(--green-dark);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.budget-unit-group {
  flex-direction: row;
  gap: 20px;
}

.unit-note {
  font-size: 11px;
  color: #999;
  font-weight: 400;
}

.field-error {
  font-size: 11px;
  color: #dc2626;
  margin-top: 3px;
}

.budget-hours-display {
  font-size: 12px;
  color: var(--green-mid);
  font-weight: 600;
  margin-top: 5px;
}

/* === TABLE SCROLL WRAPPER === */
.table-scroll { overflow-x: auto; }

.report-table { table-layout: fixed; width: 100%; }
.report-table thead th { white-space: normal; text-align: center; vertical-align: middle; }

.td-projeto {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-overtime { color: #b45309; font-weight: 600; }

.summary-card-overtime { border-left-color: #d97706; }
.summary-card-overtime .value { color: #b45309; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .page-main { padding: 16px; }
  .summary-cards { grid-template-columns: 1fr 1fr; }
  .search-input { width: 100%; margin-left: 0; }
  .pagination { margin-left: 0; }
}
