:root {
  --ink: #17243a;
  --muted: #6d788c;
  --line: #e3e8f0;
  --paper: #f5f7fb;
  --white: #fff;
  --green: #0a2b5e;
  --lime: #ed302d;
  --orange: #d94a43;
  --red: #b93338;
  --shadow: 0 12px 35px #193c2d0d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #061d43;
  color: #fff;
  padding: 25px 17px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 26px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #fff;
  color: var(--green);
  display: none;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  background: #08285a;
  box-shadow: 0 3px 10px #0003;
  flex-shrink: 0;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -.3px;
}

.brand small {
  display: block;
  color: #b4c9bd;
  font-size: 11px;
}

.group-label {
  color: #91aa9c;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  padding: 0 11px;
  margin: 9px 0 8px;
}

.nav {
  display: grid;
  gap: 4px;
}

.mobile-nav {
  display: none;
}

.nav button {
  border: 0;
  background: transparent;
  color: #cedbd3;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav button:hover,
.nav button.active {
  background: #ffffff17;
  color: #fff;
}

.nav .ico {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.nav .badge {
  margin-left: auto;
  background: #ed302d;
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
}

.side-bottom {
  margin-top: auto;
  border-top: 1px solid #ffffff22;
  padding: 16px 8px 0;
  color: #bfd0c6;
  font-size: 12px;
}

.sync-card {
  background: #ffffff12;
  border: 1px solid #ffffff1c;
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 14px;
  font-size: 11px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
}

.dot.online {
  background: #22c55e;
}

.dot.error {
  background: #ef4444;
}

.sync-meta {
  color: #b4c9bd;
  font-size: 10px;
  margin-top: 4px;
}

.side-btn {
  margin-top: 8px;
  width: 100%;
  border: 1px solid #ffffff30;
  background: #ffffff14;
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11px;
  text-align: center;
}

.side-btn:hover {
  background: #ffffff24;
}

.user {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  color: white;
}

.avatar {
  height: 34px;
  width: 34px;
  display: grid;
  place-items: center;
  background: #d9e8d6;
  color: #244939;
  border-radius: 50%;
  font-weight: 700;
}

.main {
  min-width: 0;
}

.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  background: #ffffffc9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 3;
  backdrop-filter: blur(10px);
}

.crumb {
  font-size: 13px;
  color: var(--muted);
}

.crumb b {
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select,
.icon-btn,
.input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--ink);
  font: inherit;
}

.icon-btn {
  padding: 8px 11px;
  font-size: 13px;
}

.content {
  max-width: 1320px;
  margin: 0 auto;
  padding: 34px 36px 60px;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 750;
  font-size: 10px;
}

.heading h1 {
  font-size: 29px;
  letter-spacing: -1px;
  margin: 4px 0;
}

.heading p {
  margin: 0;
  color: var(--muted);
}

.primary {
  border: 0;
  background: var(--green);
  color: white;
  padding: 11px 15px;
  border-radius: 10px;
  font-weight: 650;
  box-shadow: 0 5px 14px #174f3e22;
}

.primary:hover {
  background: #143d7d;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 600;
}

.secondary:hover {
  background: #f8fafc;
}

.danger-btn {
  border: 1px solid #f4c7c7;
  background: #fff5f5;
  color: var(--red);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--white);
  border: 1px solid #e9ede9;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.stat {
  padding: 17px 18px;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.stat-icon {
  color: var(--green);
  background: #edf5ec;
  border-radius: 8px;
  padding: 5px 7px;
}

.stat-value {
  font-size: 25px;
  letter-spacing: -.7px;
  font-weight: 750;
  margin: 10px 0 2px;
}

.stat-note {
  font-size: 11px;
  color: var(--muted);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, .9fr);
  gap: 17px;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 16px;
  margin: 0;
  letter-spacing: -.3px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.project-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.project-title {
  font-weight: 700;
}

.project-location {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.pill {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 30px;
  white-space: nowrap;
  display: inline-block;
}

.pill.green {
  background: #e6f4e9;
  color: #32734b;
}

.pill.amber {
  background: #fff1dc;
  color: #9b6825;
}

.pill.blue {
  background: #e6f0f8;
  color: #3f6b8b;
}

.pill.red {
  background: #fae9e7;
  color: var(--red);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin: 13px 0 6px;
}

.progress {
  height: 6px;
  background: #edf0ec;
  border-radius: 20px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: #4b8a64;
  border-radius: 20px;
}

.project-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 11px;
  color: var(--muted);
  font-size: 11px;
}

.project-foot b {
  color: var(--ink);
  font-weight: 650;
}

.right-stack {
  display: grid;
  gap: 17px;
  align-content: start;
}

.alert {
  display: flex;
  gap: 11px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.alert:last-child {
  border: 0;
  padding-bottom: 0;
}

.alert-mark {
  height: 28px;
  min-width: 28px;
  border-radius: 9px;
  background: #fff1dc;
  color: #9b6825;
  display: grid;
  place-items: center;
}

.alert-mark.red {
  background: #fae9e7;
  color: var(--red);
}

.alert strong {
  font-size: 12px;
  display: block;
}

.alert span {
  color: var(--muted);
  font-size: 11px;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 12px;
  gap: 10px;
}

.activity-row:last-child {
  border: 0;
}

.activity-row span {
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 11px;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tr:last-child td {
  border: 0;
}

.tag {
  color: var(--green);
  background: #edf5ec;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  display: inline-block;
}

.diary {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 12px;
  margin: 10px 0;
}

.diary-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.diary h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.diary p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0;
}

.diary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.notice {
  margin-top: 16px;
  border-radius: 10px;
  background: #f1f6eb;
  color: #43654b;
  padding: 12px;
  font-size: 11px;
}

.mobile-head {
  display: none;
}

.measurement-filters,
.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attendance-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 2px 0 18px;
}

.attendance-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.attendance-controls input,
.attendance-controls select {
  min-width: 210px;
}

.attendance-table {
  min-width: 920px;
}

.absence-check {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.absence-note {
  min-width: 180px;
  width: 100%;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  font-size: 12px;
}

.attendance-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.attendance-actions span {
  color: var(--green);
  font-size: 12px;
}

.attendance-actions span.error {
  color: var(--red);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #0b16297a;
  display: none;
  place-items: center;
  padding: 18px;
  z-index: 40;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: 100%;
  max-width: 580px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px #061d4340;
  max-height: 92vh;
  overflow: auto;
}

.modal.wide {
  max-width: 920px;
}

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

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  padding: 20px 22px;
  display: grid;
  gap: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}

.field textarea {
  min-height: 74px;
  resize: vertical;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #061d43;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 10px 30px #0004;
  z-index: 50;
  display: none;
}

.toast.show {
  display: block;
}

.toast.error {
  background: var(--red);
}

@media (max-width: 1050px) {
  .app {
    grid-template-columns: 215px 1fr;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .columns {
    grid-template-columns: 1fr;
  }
  .right-stack {
    grid-template-columns: 1fr 1fr;
  }
  .topbar {
    padding: 0 24px;
  }
  .content {
    padding: 28px 24px;
  }
}

@media (max-width: 680px) {
  .app {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #061d43;
    color: #fff;
    padding: 13px 16px;
  }
  .mobile-head .brand {
    padding: 0;
  }
  .mobile-head .brand-mark {
    width: 32px;
    height: 32px;
  }
  .mobile-head .brand-logo {
    width: 34px;
    height: 34px;
  }
  .mobile-head button {
    background: transparent;
    border: 1px solid #ffffff44;
    color: white;
    border-radius: 8px;
    padding: 6px 9px;
  }
  .mobile-nav {
    display: flex;
    overflow: auto;
    gap: 5px;
    background: #061d43;
    padding: 0 12px 12px;
  }
  .mobile-nav button {
    white-space: nowrap;
    border: 0;
    border-radius: 20px;
    background: #ffffff16;
    color: #d9e6de;
    padding: 8px 11px;
    font-size: 11px;
  }
  .mobile-nav button.active {
    background: #ed302d;
    color: #fff;
  }
  .topbar {
    height: 54px;
    padding: 0 16px;
  }
  .top-actions {
    gap: 8px;
  }
  .top-actions .select {
    font-size: 11px;
    padding: 7px;
  }
  .crumb {
    font-size: 11px;
  }
  .content {
    padding: 23px 15px 40px;
  }
  .heading h1 {
    font-size: 24px;
  }
  .stats {
    gap: 9px;
  }
  .stat {
    padding: 13px;
  }
  .stat-value {
    font-size: 21px;
  }
  .right-stack {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 16px;
  }
  .table {
    min-width: 630px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Recibo de Pagamento de Salário (2 vias — modelo clássico) */
.print-area {
  display: none;
}

.receipt-preview-wrap {
  background: #f1f4f9;
  padding: 14px;
  border-radius: 10px;
  overflow-x: auto;
}

.receipt-page {
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10.5px;
  line-height: 1.25;
}

.receipt-cut {
  border-top: 1px dashed #666;
  margin: 14px 0;
  text-align: center;
  position: relative;
  height: 1px;
}

.receipt-cut span {
  position: relative;
  top: -7px;
  background: #fff;
  padding: 0 8px;
  font-size: 9px;
  color: #666;
}

.holerite {
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-width: 720px;
}

.holerite-main {
  flex: 1;
  min-width: 0;
}

.holerite-box {
  border: 1px solid #000;
}

.holerite-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 8px;
  gap: 12px;
}

.holerite-emp {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.holerite-logo {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #d0d7e2;
  flex-shrink: 0;
}

.holerite-emp-lines {
  display: grid;
  gap: 2px;
  font-size: 10px;
}

.holerite-emp-lines .emp-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .3px;
}

.holerite-doc-title {
  text-align: right;
}

.holerite-doc-title h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #000;
}

.holerite-doc-title small {
  font-size: 10px;
  color: #111;
}

.holerite-emp-bar {
  margin-top: 5px;
  border: 1px solid #000;
  display: grid;
  grid-template-columns: 74px 1.6fr 78px 1fr;
  gap: 8px;
  padding: 4px 8px;
}

.holerite-emp-bar .lbl {
  display: block;
  font-size: 8.5px;
  text-transform: uppercase;
  color: #222;
}

.holerite-emp-bar .val {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}

.holerite-table-wrap {
  margin-top: 5px;
  border: 1px solid #000;
}

.holerite-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  table-layout: fixed;
}

.holerite-table th {
  border-bottom: 1px solid #000;
  border-right: 1px solid #000;
  padding: 3px 6px;
  font-weight: 700;
  text-align: left;
  font-size: 10px;
}

.holerite-table th:last-child,
.holerite-table td:last-child {
  border-right: 0;
}

.holerite-table th.num,
.holerite-table td.num {
  text-align: right;
}

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

.holerite-table tbody td {
  border-right: 1px solid #000;
  padding: 2px 6px;
  vertical-align: top;
}

.holerite-items-pad td {
  height: 52px;
}

.holerite-summary-row td {
  border-top: 1px solid #000;
  border-right: 1px solid #000;
  padding: 3px 6px;
  vertical-align: top;
}

.holerite-summary-label {
  font-size: 8.5px;
  display: block;
}

.holerite-summary-val {
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  display: block;
  margin-top: 1px;
}

.holerite-net-row td {
  border-top: 1px solid #000;
  padding: 4px 6px;
  font-weight: 700;
  font-size: 11px;
}

.holerite-bases {
  border-top: 1px solid #000;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 3px 6px;
  gap: 6px;
}

.holerite-bases .b-lbl {
  display: block;
  font-size: 8px;
  text-align: right;
}

.holerite-bases .b-val {
  display: block;
  font-size: 10.5px;
  text-align: right;
  font-weight: 600;
}

.holerite-via {
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .3px;
}

.holerite-side {
  width: 56px;
  border: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
  flex-shrink: 0;
  overflow: hidden;
}

.holerite-decl {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 7px;
  line-height: 1.15;
  text-align: center;
  max-height: 100%;
}

.holerite-sign-col {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  max-height: 100%;
  font-size: 7.5px;
}

.holerite-sign-block {
  display: flex;
  align-items: center;
  gap: 3px;
}

.holerite-sign-line {
  border-left: 1px solid #000;
  height: 105px;
}

.holerite-date-line {
  border-left: 1px solid #000;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 2px;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }
  body {
    background: #fff !important;
  }
  .app,
  .modal-backdrop,
  .toast {
    display: none !important;
  }
  #printArea {
    display: block !important;
  }
  .receipt-page {
    page-break-after: always;
    break-after: page;
  }
  .receipt-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .holerite {
    min-width: 0;
    width: 100%;
  }
}
