:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1d232a;
  --muted: #667085;
  --line: #d7dde5;
  --brand: #1b6b5f;
  --brand-dark: #114c45;
  --warn: #a45b11;
  --danger: #b42318;
  --soft: #e9f4f2;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button.secondary {
  background: #e7ecef;
  color: var(--ink);
}

button.ghost {
  background: transparent;
  color: var(--brand-dark);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.profile-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-options.compact {
  min-width: 300px;
}

.check-option {
  width: auto;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.check-option input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
}

.auth-panel {
  background: var(--panel);
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  border-right: 1px solid var(--line);
}

.auth-panel h1,
.page-title h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.auth-art {
  background:
    linear-gradient(rgba(17, 76, 69, 0.74), rgba(17, 76, 69, 0.46)),
    url("https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&w=1800&q=80") center/cover;
  min-height: 100%;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-switch {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.main-header {
  background: #132520;
  color: #f7fbfa;
  min-height: 72px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.brand {
  font-weight: 700;
  font-size: 18px;
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav button {
  text-align: left;
  background: transparent;
  color: #d8e4e1;
  border: 1px solid transparent;
}

.nav button.active {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 26px;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.import-button {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: #e7ecef;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
}

.import-button input {
  display: none;
}

.import-edital-button {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: #e7ecef;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
}

.import-edital-button input {
  display: none;
}

.profile-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  background: #f7fbfa;
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.profile-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 50px;
  width: 260px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(16, 24, 40, 0.18);
  padding: 14px;
  gap: 8px;
  z-index: 8;
}

.profile-menu.open {
  display: grid;
}

.profile-menu span {
  color: var(--muted);
  font-size: 13px;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title {
  display: grid;
  gap: 6px;
}

.page-title p,
.empty,
.hint {
  margin: 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 180px;
}

.status-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 6px;
}

.status-filter button {
  min-height: 34px;
  white-space: nowrap;
  background: #e7ecef;
  color: #344054;
}

.status-filter button.active {
  background: var(--brand);
  color: #fff;
}

.status-filter strong {
  margin-left: 6px;
}

.status-select {
  min-width: 132px;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.status-select.is-finalized {
  background: var(--soft);
  border-color: transparent;
  color: var(--brand-dark);
  font-weight: 700;
}

.status-cell {
  display: grid;
  gap: 8px;
  min-width: 150px;
  justify-items: start;
}

.compact-badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.move-finalized {
  min-height: 30px;
  padding: 0 10px;
  background: var(--brand-dark);
  font-size: 12px;
  white-space: nowrap;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi,
.panel,
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi {
  padding: 16px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-width: 100%;
  padding-bottom: 10px;
  scrollbar-color: var(--brand) #e7ecef;
  scrollbar-width: thin;
}

.process-table-wrap {
  border-top: 1px solid var(--line);
  overflow-x: scroll;
}

.top-scroll {
  overflow-x: scroll;
  overflow-y: hidden;
  height: 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
  scrollbar-color: var(--brand) #e7ecef;
  scrollbar-width: thin;
}

.top-scroll div {
  height: 1px;
}

.top-scroll::-webkit-scrollbar {
  height: 14px;
}

.top-scroll::-webkit-scrollbar-track {
  background: #e7ecef;
}

.top-scroll::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 999px;
  border: 3px solid #e7ecef;
}

.table-wrap::-webkit-scrollbar {
  height: 14px;
  width: 12px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #e7ecef;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 999px;
  border: 3px solid #e7ecef;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1850px;
}

.process-table-wrap table {
  min-width: 2400px;
}

.users-table {
  min-width: 980px;
}

.users-table input,
.users-table select {
  min-width: 180px;
}

.scroll-hint {
  padding: 10px 16px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: #44515f;
  background: #f8fafb;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.truncate {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrap-text {
  min-width: 420px;
  max-width: 620px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.35;
}

.small-wrap {
  min-width: 260px;
  max-width: 360px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 12px;
}

.badge.warn {
  background: #fff3e3;
  color: var(--warn);
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  min-height: 30px;
  padding: 0 9px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.48);
}

.modal {
  width: min(960px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
}

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

.modal-head h2 {
  margin: 0;
  font-size: 19px;
}

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

.form-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

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

.reabertura-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}

.subsection-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

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

.reabertura-row {
  display: grid;
  grid-template-columns: 160px 140px 1fr auto;
  gap: 10px;
  align-items: end;
}

.notice {
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff3e3;
  color: #8a4b0f;
  font-size: 14px;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-field input {
  min-width: 0;
}

.password-field button {
  min-height: 38px;
}

.dashboard-grid,
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 16px;
}

.global-status-filter {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 10px;
  scrollbar-color: var(--brand) #e7ecef;
  scrollbar-width: thin;
}

.global-status-filter button {
  flex: 0 0 auto;
}

.global-status-filter::-webkit-scrollbar {
  height: 12px;
}

.global-status-filter::-webkit-scrollbar-track {
  background: #e7ecef;
}

.global-status-filter::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 999px;
}

.general-dashboard {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.general-table-wrap table {
  min-width: 1300px;
}

.summary-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.summary-list span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.upcoming-list,
.month-events,
.status-bars {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.upcoming-item,
.month-event {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.upcoming-item:last-child,
.month-event:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.date-card {
  min-height: 68px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
}

.date-card strong {
  font-size: 20px;
}

.date-card span,
.event-line,
.month-event p,
.upcoming-item p {
  font-size: 13px;
}

.event-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.month-event p,
.upcoming-item p {
  margin: 8px 0;
  color: #44515f;
  line-height: 1.35;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr 42px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: #e7ecef;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--brand);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
}

.calendar-weekdays {
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.calendar-weekdays strong {
  padding: 10px;
  color: #44515f;
  font-size: 12px;
}

.calendar-cell {
  min-height: 132px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: #fff;
}

.calendar-cell.today {
  box-shadow: inset 0 0 0 2px var(--brand);
}

.muted-cell {
  background: #f8fafb;
}

.cell-day {
  font-weight: 700;
  color: #344054;
  margin-bottom: 6px;
}

.cell-events {
  display: grid;
  gap: 5px;
}

.calendar-event {
  width: 100%;
  min-height: 28px;
  padding: 5px 7px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--brand-dark);
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event.reopen {
  background: #fff3e3;
  color: var(--warn);
}

.calendar-event span {
  font-weight: 700;
}

.workflow-badge {
  background: #eef2ff;
  color: #24418f;
  max-width: 180px;
  white-space: normal;
  line-height: 1.2;
}

.workflow-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}

.workflow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.workflow-head h3 {
  margin: 0;
  font-size: 16px;
}

.workflow-head span {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.movement-list {
  display: grid;
  gap: 8px;
}

.movement-item {
  border-left: 3px solid var(--brand);
  padding-left: 10px;
}

.movement-item strong,
.movement-item span {
  display: block;
}

.movement-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.more-events,
.padded {
  padding: 10px;
}

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-art {
    display: none;
  }

  .main-header {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .header-actions {
    margin-left: 0;
    justify-content: space-between;
  }

  .kpis,
  .form-grid,
  .dashboard-grid,
  .calendar-layout,
  .reabertura-row {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(48px, 1fr));
  }

  .calendar-cell {
    min-height: 98px;
    padding: 5px;
  }

  .calendar-event {
    font-size: 11px;
  }

  .toolbar input,
  .toolbar select {
    width: 100%;
  }
}
